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 111ABA0553; Sat, 11 Jun 2022 14:26:03 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CE4294069C; Sat, 11 Jun 2022 14:26:01 +0200 (CEST) Received: from forward500p.mail.yandex.net (forward500p.mail.yandex.net [77.88.28.110]) by mails.dpdk.org (Postfix) with ESMTP id 5157C40689 for ; Sat, 11 Jun 2022 14:26:00 +0200 (CEST) Received: from iva8-6b29e352664c.qloud-c.yandex.net (iva8-6b29e352664c.qloud-c.yandex.net [IPv6:2a02:6b8:c0c:5b2e:0:640:6b29:e352]) by forward500p.mail.yandex.net (Yandex) with ESMTP id 977BEF01DCE; Sat, 11 Jun 2022 15:25:59 +0300 (MSK) Received: from iva4-143b1447cf50.qloud-c.yandex.net (iva4-143b1447cf50.qloud-c.yandex.net [2a02:6b8:c0c:7511:0:640:143b:1447]) by iva8-6b29e352664c.qloud-c.yandex.net (mxback/Yandex) with ESMTP id MMtMegWGhi-PwfWFiSg; Sat, 11 Jun 2022 15:25:59 +0300 X-Yandex-Fwd: 2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1654950359; bh=mfn6Yl85yTtMPT6HIDTAiH1aKi0JbO9s/YP/8aIgC0o=; h=In-Reply-To:From:Subject:Cc:References:Date:Message-ID:To; b=Pv47gnD6/NuQJQnVzaF9czCXqZpuu0Gf01gD1EyjoO5jbNByqgGRCRKgcC99NklA+ LyfDp3Ff9EvzvXS/pNwg6hCbHIPklSsUjgdf1EjPd4bZkPk2ZsTiknhJzLNSbQTPEh Z42u5MIkk2Xme+F31MvuDlHFGjVg3orVEoTy8BrI= Authentication-Results: iva8-6b29e352664c.qloud-c.yandex.net; dkim=pass header.i=@yandex.ru Received: by iva4-143b1447cf50.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id jzv5hdpXjF-PvMikqXm; Sat, 11 Jun 2022 15:25:58 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) Message-ID: Date: Sat, 11 Jun 2022 13:25:56 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH 3/6] eal: add basic rte thread ID equal API Content-Language: en-US To: Tyler Retzlaff Cc: dev@dpdk.org, thomas@monjalon.net, dmitry.kozliuk@gmail.com, anatoly.burakov@intel.com, Narcisa Vasile 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> From: Konstantin Ananyev In-Reply-To: <20220610224819.GA14494@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 >>> 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.