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 67F80A0545; Fri, 10 Jun 2022 02:41:03 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1FC2F4069C; Fri, 10 Jun 2022 02:41:03 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id C8CDB40689 for ; Fri, 10 Jun 2022 02:41:01 +0200 (CEST) Received: from dggpeml500024.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4LK2DJ0XhlzjXNt; Fri, 10 Jun 2022 08:40:00 +0800 (CST) Received: from [127.0.0.1] (10.67.100.224) by dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 10 Jun 2022 08:40:59 +0800 Subject: Re: [PATCH 3/6] eal: add basic rte thread ID equal API To: Tyler Retzlaff , CC: , , , Narcisa Vasile References: <1654783134-13303-1-git-send-email-roretzla@linux.microsoft.com> <1654783134-13303-4-git-send-email-roretzla@linux.microsoft.com> From: fengchengwen Message-ID: Date: Fri, 10 Jun 2022 08:40:59 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <1654783134-13303-4-git-send-email-roretzla@linux.microsoft.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.100.224] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml500024.china.huawei.com (7.185.36.10) X-CFilter-Loop: Reflected 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 Acked-by: Chengwen Feng On 2022/6/9 21:58, Tyler Retzlaff 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; > +} > + > +int > rte_thread_attr_init(rte_thread_attr_t *attr) > { > RTE_VERIFY(attr != NULL); > diff --git a/lib/eal/include/rte_thread.h b/lib/eal/include/rte_thread.h > index 321fb59..32ab745 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/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; >