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 165F5A0C4B; Tue, 9 Nov 2021 03:04:02 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0178C40687; Tue, 9 Nov 2021 03:04:02 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 426D940151 for ; Tue, 9 Nov 2021 03:04:01 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1059) id 972C220B9D58; Mon, 8 Nov 2021 18:04:00 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 972C220B9D58 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1636423440; bh=NjCtAQZvNgb1/Nd6nJ2Be6E5OoyQH42GekVhRLSNpj0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=nnkcN+aCkosfsZb/ZuX9nTH9PzEdEMTOJi1KQq/AVK136T6L/l31j4rhpCOwDUV1A uaRcTAkrlQJKOOnOSeqlGjmBqzK4bAeoEzBQ+s4cV5y9Sdo+1ojfXP0UwTCD3wzdrj Tk5hOPVdOoycxlIN4cIrQvWTEJQ7bxhCECC0+Kus= Date: Mon, 8 Nov 2021 18:04:00 -0800 From: Narcisa Ana Maria Vasile To: Thomas Monjalon Cc: dev@dpdk.org, dmitry.kozliuk@gmail.com, khot@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: <20211109020400.GD12569@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: <1633732841-17873-1-git-send-email-navasile@linux.microsoft.com> <1633765318-28356-1-git-send-email-navasile@linux.microsoft.com> <1633765318-28356-8-git-send-email-navasile@linux.microsoft.com> <77814428.nxW8SpuB8v@thomas> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <77814428.nxW8SpuB8v@thomas> User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: [dpdk-dev] [PATCH v16 7/9] eal: implement functions for mutex 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 Tue, Oct 12, 2021 at 06:28:56PM +0200, Thomas Monjalon wrote: > 09/10/2021 09:41, Narcisa Ana Maria Vasile: > > From: Narcisa Vasile > > > > Add functions for mutex init, destroy, lock, unlock, trylock. > > > > Add RTE_STATIC_MUTEX macro to replace static initialization > > of mutexes. > > Windows does not have a static initializer. > > Initialization is only done through InitializeCriticalSection(). > > > > The RTE_STATIC_MUTEX calls into the rte_thread_mutex_init() > > function that performs the actual mutex initialization. > [...] > > --- a/lib/eal/include/rte_thread.h > > +++ b/lib/eal/include/rte_thread.h > > +#define RTE_DECLARE_MUTEX(private_lock) rte_thread_mutex private_lock > > + > > +#define RTE_DEFINE_MUTEX(private_lock)\ > > +RTE_INIT(__rte_ ## private_lock ## _init)\ > > +{\ > > + RTE_VERIFY(rte_thread_mutex_init(&private_lock) == 0);\ > > +} > > + > > +#define RTE_STATIC_MUTEX(private_lock)\ > > +static RTE_DECLARE_MUTEX(private_lock);\ > > +RTE_DEFINE_MUTEX(private_lock) > > This is not truly static. > It is a wrapper to init the mutex in the constructor. > Should we rename? > Agreed, I'll rename to RTE_MUTEX_INIT or something like this. Thanks!