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 433B6A0A0C; Fri, 18 Jun 2021 23:41:05 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BC0CA410DE; Fri, 18 Jun 2021 23:41:04 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id B621C40150 for ; Fri, 18 Jun 2021 23:41:03 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1059) id 0878220B7178; Fri, 18 Jun 2021 14:41:03 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 0878220B7178 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1624052463; bh=B0jk8amNDedZSaCtQ3kURV7K5XDUfYyXuWJ3IxNdcTU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=YKtjU7OG3ydvmXyVCHdS17NQkQ2zDqDYZD8mKUNoRzKFLDp5yHq/1dsEO8YeHVTQr js6/UBtTsUeovKX1uMwjCM+zJymwAIA5FZYSLFc2FJZ/np0LOW2ihtjB66GGrS26dg L/NuUwjqFzYRhvQHSaCwVjKE9x6eQ+URMjY0YFCw= Date: Fri, 18 Jun 2021 14:41:03 -0700 From: Narcisa Ana Maria Vasile To: Dmitry Kozlyuk Cc: dev@dpdk.org, thomas@monjalon.net, khot@microsoft.com, navasile@microsoft.com, dmitrym@microsoft.com, roretzla@microsoft.com, talshn@nvidia.com, ocardona@microsoft.com, bruce.richardson@intel.com, david.marchand@redhat.com, pallavi.kadam@intel.com Message-ID: <20210618214102.GB26950@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: <1622849908-5710-1-git-send-email-navasile@linux.microsoft.com> <1622850274-6946-1-git-send-email-navasile@linux.microsoft.com> <1622850274-6946-7-git-send-email-navasile@linux.microsoft.com> <20210609020409.0c1fb82b@sovereign> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210609020409.0c1fb82b@sovereign> User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: [dpdk-dev] [PATCH v9 06/10] eal: add thread lifetime management 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 Sender: "dev" On Wed, Jun 09, 2021 at 02:04:09AM +0300, Dmitry Kozlyuk wrote: > 2021-06-04 16:44 (UTC-0700), Narcisa Ana Maria Vasile: > [...] > > diff --git a/lib/eal/include/rte_thread.h b/lib/eal/include/rte_thread.h > > index 5c54cd9d67..1d481b9ad5 100644 > > --- a/lib/eal/include/rte_thread.h > > +++ b/lib/eal/include/rte_thread.h > > +__rte_experimental > > +int rte_thread_create(rte_thread_t *thread_id, > > + const rte_thread_attr_t *thread_attr, > > + void *(*thread_func)(void *), void *args); > > 1. Thread function prototype is used at least in 4 places, > maybe give it a name, like `rte_thread_func`? > > 2. We can't easily support it's `void*` return type on Windows, > because it doesn't fit in DWORD. In `rte_thread_join` below you use `int`. > All `pthread_join` usages in DPDK ignore return value, but I'd rather keep it. > Do you think it's OK to stick to `int`? > Thank you, I agree that we should keep it. I've changed it to unsigned long to fit with Windows's DWORD as well. > [...] > > +/** > > + * Terminates a thread. > > + * > > + * @param thread_id > > + * The id of the thread to be cancelled. > > + * > > + * @return > > + * On success, return 0. > > + * On failure, return a positive errno-style error number. > > + */ > > +__rte_experimental > > +int rte_thread_cancel(rte_thread_t thread_id); > > What do you think of making this function internal for now? > We don't want applications to rely on this prototype. > To hide it from Doxygen, `/*` comment or #ifndef __DOXYGEN__ can be used. > It is worth noting in commit message > that it's not implemented for Windows and why. > Thank you, I've removed it for now. > > + > > + HANDLE thread_handle = NULL; > > + GROUP_AFFINITY thread_affinity; > > + struct thread_routine_ctx *ctx = NULL; > > + > > + ctx = calloc(1, sizeof(*ctx)); > > Why use `calloc()` for a scalar? ctx is pointer to struct that holds the thread function pointer and its arguments. Did I misunderstand what you meant? >