From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 59B58A04DB; Thu, 15 Oct 2020 04:15:53 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9F68D1DB08; Thu, 15 Oct 2020 04:15:50 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by dpdk.org (Postfix) with ESMTP id BA6B31DA31 for ; Thu, 15 Oct 2020 04:15:47 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1059) id E6FAE20B4905; Wed, 14 Oct 2020 19:15:45 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com E6FAE20B4905 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1602728145; bh=qX6DeKuZUsFsYBdjZaj4RYEDSVUfXMnjPzED7YFVinM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=eYa5NcBoMAfZIIsJHkeojm15B6JC9GPRaSVGiyuu2yBq137YkYIO0ILbjWydLjK5s 8Ncls6/qYS0RQOYzdOfpAMTaWQZQnxrUJMYBCmIGH9niL06UFb/pXbbaAqbgeGZckT zQUc6GLTpXeZzvhDJjtqKk+sB/Jx/xd5MaTEvm7M= Date: Wed, 14 Oct 2020 19:15:45 -0700 From: Narcisa Ana Maria Vasile To: Suanming Mou Cc: Dmitry Kozlyuk , Dmitry Malloy , Pallavi Kadam , dev@dpdk.org Message-ID: <20201015021545.GA26401@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: <1601194817-208834-1-git-send-email-suanmingm@nvidia.com> <1602206243-157603-1-git-send-email-suanmingm@nvidia.com> <1602206243-157603-2-git-send-email-suanmingm@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1602206243-157603-2-git-send-email-suanmingm@nvidia.com> User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: [dpdk-dev] [PATCH v4 1/2] eal/windows: add pthread mutex lock 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" On Fri, Oct 09, 2020 at 09:17:22AM +0800, Suanming Mou wrote: > Add pthread mutex lock as it is needed for the thread safe rte_flow > functions. > > Signed-off-by: Suanming Mou > Acked-by: Dmitry Kozlyuk > --- > > v4: > - Add PTHREAD_MUTEX_INITIALIZER macro. > > v3: > - No updates. > > v2: > - Using critical section for windows pthread mutex. > > --- > > lib/librte_eal/windows/include/pthread.h | 35 ++++++++++++++++++++++++++++++++ > 1 file changed, 35 insertions(+) > > diff --git a/lib/librte_eal/windows/include/pthread.h b/lib/librte_eal/windows/include/pthread.h > index 99013dc..c62251f 100644 > --- a/lib/librte_eal/windows/include/pthread.h > +++ b/lib/librte_eal/windows/include/pthread.h > @@ -28,6 +28,12 @@ > /* defining pthread_attr_t type on Windows since there is no in Microsoft libc*/ > typedef void *pthread_attr_t; > > +typedef void *pthread_mutexattr_t; > + > +typedef CRITICAL_SECTION pthread_mutex_t; > + > +#define PTHREAD_MUTEX_INITIALIZER {(void *)-1, -1, 0, 0, 0, 0} > + Regarding the question on the static initializer, adding the guidance from DmitryM: "If you choose to do the static initializer, you will be relying on implementation specifics, (which may have not changed ever, or may not ever change, or may change in the next release). This would be a hack (although potentially long term)." Otherwise, Acked-by: Narcisa Vasile