From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5213DC433E0 for ; Thu, 21 May 2020 00:33:19 +0000 (UTC) Received: from dpdk.org (dpdk.org [92.243.14.124]) by mail.kernel.org (Postfix) with ESMTP id E984F20748 for ; Thu, 21 May 2020 00:33:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E984F20748 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mellanox.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 475771C211; Thu, 21 May 2020 02:33:18 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id BA2C61C1FB for ; Thu, 21 May 2020 02:33:16 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE2 (envelope-from tbashar@mellanox.com) with ESMTPS (AES256-SHA encrypted); 21 May 2020 03:33:13 +0300 Received: from mtsdev.labs.mlnx (mtsdev.mts.labs.mlnx [10.9.76.240]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 04L0XAL2031115; Thu, 21 May 2020 03:33:10 +0300 From: Tasnim Bashar To: dev@dpdk.org Cc: harini.ramakrishnan@microsoft.com, pallavi.kadam@intel.com, ranjit.menon@intel.com, ocardona@microsoft.com, navasile@linux.microsoft.com, dmitry.kozliuk@gmail.com, talshn@mellanox.com, fady@mellanox.com, ophirmu@mellanox.com, thomas@monjalon.net Date: Wed, 20 May 2020 17:32:53 -0700 Message-Id: <20200521003253.75212-1-tbashar@mellanox.com> X-Mailer: git-send-email 2.19.1.windows.1 In-Reply-To: <20200518142634> References: <20200518142634> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2] eal/windows: support thread ID query X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Add rte_sys_gettid function to use rte_gettid() on Windows. rte_gettid() is required for recursive spin lock and recursive ticket lock. Signed-off-by: Tasnim Bashar --- v2: remove eal_thread_self function and fix style --- lib/librte_eal/windows/eal_thread.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/librte_eal/windows/eal_thread.c b/lib/librte_eal/windows/eal_thread.c index e149199a6f..4c1e31c58a 100644 --- a/lib/librte_eal/windows/eal_thread.c +++ b/lib/librte_eal/windows/eal_thread.c @@ -64,12 +64,6 @@ eal_thread_init_master(unsigned int lcore_id) RTE_PER_LCORE(_lcore_id) = lcore_id; } -static inline pthread_t -eal_thread_self(void) -{ - return GetCurrentThreadId(); -} - /* main loop of threads */ void * eal_thread_loop(void *arg __rte_unused) @@ -81,7 +75,7 @@ eal_thread_loop(void *arg __rte_unused) int m2s, s2m; char cpuset[RTE_CPU_AFFINITY_STR_LEN]; - thread_id = eal_thread_self(); + thread_id = pthread_self(); /* retrieve our lcore_id from the configuration structure */ RTE_LCORE_FOREACH_SLAVE(lcore_id) { @@ -157,6 +151,13 @@ eal_thread_create(pthread_t *thread) return 0; } +/* get current thread ID */ +int +rte_sys_gettid(void) +{ + return GetCurrentThreadId(); +} + int rte_thread_setname(__rte_unused pthread_t id, __rte_unused const char *name) { -- 2.19.1.windows.1