From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id DA839A0553; Mon, 13 Jun 2022 15:39:39 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8FBFF40150; Mon, 13 Jun 2022 15:39:39 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id D5F38400EF for ; Mon, 13 Jun 2022 15:39:37 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 192DC20C155D; Mon, 13 Jun 2022 06:39:37 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 192DC20C155D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1655127577; bh=IJmNPIgkBAC69TRFv8GGUTORASoU2q1NqnPAtM52lX8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ZfuFv6qTECGNLrk6rX40hkKzV/v5VBTZ62HXk6MgcNh2/XexRJ6Ulil5qFnwHwNzm xVw0LwdJkRS9Eoj/7/28uCg1S9KuLM1zAxA+uNKgilp+Q9GVDKhhKN8ckdDDNUuFPK B5giZWLnuR4LGHU99JN/Ny6x3eLHYj0lXc8KlQKc= Date: Mon, 13 Jun 2022 06:39:37 -0700 From: Tyler Retzlaff To: Konstantin Ananyev Cc: dev@dpdk.org, thomas@monjalon.net, dmitry.kozliuk@gmail.com, anatoly.burakov@intel.com, Narcisa Vasile Subject: Re: [PATCH 3/6] eal: add basic rte thread ID equal API Message-ID: <20220613133937.GA29682@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: <1654783134-13303-1-git-send-email-roretzla@linux.microsoft.com> <1654783134-13303-4-git-send-email-roretzla@linux.microsoft.com> <3f267f58-3c30-8963-3b03-c33e4c270397@yandex.ru> <20220610224819.GA14494@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Sat, Jun 11, 2022 at 01:25:56PM +0100, Konstantin Ananyev wrote: > > >>>Add rte_thread_equal() that tests if two rte_thread_id are equal. > >>> > >>>Signed-off-by: Narcisa Vasile > >>>Signed-off-by: Tyler Retzlaff > >>>--- > >>> lib/eal/common/rte_thread.c | 6 ++++++ > >>> lib/eal/include/rte_thread.h | 19 +++++++++++++++++++ > >>> lib/eal/version.map | 1 + > >>> 3 files changed, 26 insertions(+) > >>> > >>>diff --git a/lib/eal/common/rte_thread.c b/lib/eal/common/rte_thread.c > >>>index 10d6652..21ed042 100644 > >>>--- a/lib/eal/common/rte_thread.c > >>>+++ b/lib/eal/common/rte_thread.c > >>>@@ -6,6 +6,12 @@ > >>> #include > >>> int > >>>+rte_thread_equal(rte_thread_t t1, rte_thread_t t2) > >>>+{ > >>>+ return t1.opaque_id == t2.opaque_id; > >> > >>for posix systems, why not: > >>return pthread_equal(t1.opaque_id, t2.opaque_id); > > > >because it would require 2 implementations > > We already have plenty of such cases for rte_thread implementation. > Why it became a problem here? > > when this works for both > >windows and posix platforms. (less code to maintain, no functional > >difference). > > > > Well posix insists that the only safe way for applications to > directly compare two pthread_t values is to call pthread_equal(). > So I'd suggest we do what is recommended. agreed, will provide a v2 that uses pthread_equal().