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 49632A0545; Mon, 20 Jun 2022 10:34:57 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DF62C40F19; Mon, 20 Jun 2022 10:34:56 +0200 (CEST) Received: from forward500j.mail.yandex.net (forward500j.mail.yandex.net [5.45.198.250]) by mails.dpdk.org (Postfix) with ESMTP id A72C040150 for ; Mon, 20 Jun 2022 10:34:55 +0200 (CEST) Received: from iva2-e526a750381e.qloud-c.yandex.net (iva2-e526a750381e.qloud-c.yandex.net [IPv6:2a02:6b8:c0c:1993:0:640:e526:a750]) by forward500j.mail.yandex.net (Yandex) with ESMTP id 1407C6CB6A84; Mon, 20 Jun 2022 11:34:55 +0300 (MSK) Received: from iva8-a4a480c9f089.qloud-c.yandex.net (iva8-a4a480c9f089.qloud-c.yandex.net [2a02:6b8:c0c:da5:0:640:a4a4:80c9]) by iva2-e526a750381e.qloud-c.yandex.net (mxback/Yandex) with ESMTP id GNAjDhH8Sn-YsgSbBLt; Mon, 20 Jun 2022 11:34:55 +0300 X-Yandex-Fwd: 2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1655714095; bh=18pMvkTJ6he1PYB1x0IUK+or28UIZEc+eec72cZTMJU=; h=In-Reply-To:From:Subject:Cc:References:Date:Message-ID:To; b=TNMB0mil9Cds0NaNlWZyc2fduh359jCEzOvQ5DBgBQaIWOHZr0kYHBmsLGAp67V93 +1Bd6bp551wlkrdeMVz77IlL2d2NqEvSOdMe8tvlvUkIuEhsFGSOCAE4y8Cgwu9MJe pryZ28G/egl9pUzOz8WE2q+ZuAfjSJKqroVKfBr4= Authentication-Results: iva2-e526a750381e.qloud-c.yandex.net; dkim=pass header.i=@yandex.ru Received: by iva8-a4a480c9f089.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id szNQ31EsgW-YrMGDh7I; Mon, 20 Jun 2022 11:34:53 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) Message-ID: <016e0c6c-afd2-b705-58d9-7d75dc728b09@yandex.ru> Date: Mon, 20 Jun 2022 09:34:51 +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 v2 3/6] eal: add basic rte thread ID equal API Content-Language: en-US To: Tyler Retzlaff , dev@dpdk.org Cc: thomas@monjalon.net, dmitry.kozliuk@gmail.com, anatoly.burakov@intel.com, Narcisa Vasile References: <1654783134-13303-1-git-send-email-roretzla@linux.microsoft.com> <1655250438-18044-1-git-send-email-roretzla@linux.microsoft.com> <1655250438-18044-4-git-send-email-roretzla@linux.microsoft.com> From: Konstantin Ananyev In-Reply-To: <1655250438-18044-4-git-send-email-roretzla@linux.microsoft.com> 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 > Acked-by: Chengwen Feng > --- > lib/eal/include/rte_thread.h | 19 +++++++++++++++++++ > lib/eal/unix/rte_thread.c | 6 ++++++ > lib/eal/version.map | 1 + > lib/eal/windows/rte_thread.c | 6 ++++++ > 4 files changed, 32 insertions(+) > > diff --git a/lib/eal/include/rte_thread.h b/lib/eal/include/rte_thread.h > index c27e580..de0486d 100644 > --- a/lib/eal/include/rte_thread.h > +++ b/lib/eal/include/rte_thread.h > @@ -134,6 +134,25 @@ int rte_thread_create(rte_thread_t *thread_id, > __rte_experimental > rte_thread_t rte_thread_self(void); > > +/** > + * @warning > + * @b EXPERIMENTAL: this API may change without prior notice. > + * > + * Check if 2 thread ids are equal. > + * > + * @param t1 > + * First thread id. > + * > + * @param t2 > + * Second thread id. > + * > + * @return > + * If the ids are equal, return nonzero. > + * Otherwise, return 0. > + */ > +__rte_experimental > +int rte_thread_equal(rte_thread_t t1, rte_thread_t t2); > + > #ifdef RTE_HAS_CPUSET > > /** > diff --git a/lib/eal/unix/rte_thread.c b/lib/eal/unix/rte_thread.c > index 19c7b80..0304d53 100644 > --- a/lib/eal/unix/rte_thread.c > +++ b/lib/eal/unix/rte_thread.c > @@ -183,6 +183,12 @@ struct eal_tls_key { > return pthread_detach((pthread_t)thread_id.opaque_id); > } > > +int > +rte_thread_equal(rte_thread_t t1, rte_thread_t t2) > +{ > + return pthread_equal((pthread_t)t1.opaque_id, (pthread_t)t2.opaque_id); > +} > + > rte_thread_t > rte_thread_self(void) > { > diff --git a/lib/eal/version.map b/lib/eal/version.map > index 22e5c85..4a52484 100644 > --- a/lib/eal/version.map > +++ b/lib/eal/version.map > @@ -428,6 +428,7 @@ EXPERIMENTAL { > rte_thread_attr_set_priority; > rte_thread_create; > rte_thread_detach; > + rte_thread_equal; > rte_thread_get_affinity_by_id; > rte_thread_get_priority; > rte_thread_join; > diff --git a/lib/eal/windows/rte_thread.c b/lib/eal/windows/rte_thread.c > index b5f2b04..1352513 100644 > --- a/lib/eal/windows/rte_thread.c > +++ b/lib/eal/windows/rte_thread.c > @@ -291,6 +291,12 @@ struct thread_routine_ctx { > return 0; > } > > +int > +rte_thread_equal(rte_thread_t t1, rte_thread_t t2) > +{ > + return t1.opaque_id == t2.opaque_id; > +} > + > rte_thread_t > rte_thread_self(void) > { Acked-by: Konstantin Ananyev