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 BFB3AA0546; Fri, 30 Apr 2021 19:47:29 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3F4A04014F; Fri, 30 Apr 2021 19:47:29 +0200 (CEST) Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) by mails.dpdk.org (Postfix) with ESMTP id 7AB674013F for ; Fri, 30 Apr 2021 19:47:27 +0200 (CEST) Received: by mail-lf1-f48.google.com with SMTP id 4so51408032lfp.11 for ; Fri, 30 Apr 2021 10:47:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nalUT4thAhRdFp2UpM0srz0Gyz7sF5eZe1weD4IIztY=; b=RWgN/6y7PNixO7ngf+ubvZo6E2fi3+VW0Kel2uZAYXE6lGwwz4TR3wugmXoQxlxLXM sDmIdwffarj4b/fsBEGnxxVWhsc79vkOlRKdX5N4oOp5k9F4EKoEFAfi+x25yCUUzxwn VEWWe26nHHr67GOqniF4RLttXWOboaaxojc+ba4J46oGXsI0s7f2fxaGtoUdVwYyVr1l icifphF40gJ1fwZJLljasOG74G8AHgWZhwKaPwnKZnlKYlgrsmvRbEZbUhPstvtGNzWk Qj8iWyt2t4jGYr3bClDTn5pamHNOIN/2L8UkhXBggrEKzlH/Gr6yUwj+coyRB34wMAHf dBgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nalUT4thAhRdFp2UpM0srz0Gyz7sF5eZe1weD4IIztY=; b=TFnm79WNbLlTHLnrWUR0kWIz8kw3eWwDa/51WDzqlcifuowO7MYa+23zM0Fecg0ZuT 9qFh6tLR3yI3OYNp5aTEcft0gUpPX8bo2f2qJ/Lg1Qh3c+ViPBabtpFjvFNL/NMY3BYi g+d1+6o90vLUK2cZQMlPJu+5y6/2fn+ALn9EQCb0Hqk7j38m9DOUAiFa5F9k7hNZLTJ5 GnoEdv55VXJTNeC6siY0SG0DaM1oxneGsH1RhqCSAlheIZWzF1MrCpv6tKj5IA6xgqCp ihxzOg2Q9EoDa+kH50XQPaGFbOV0mDRbGlpvAFk3X8jZnWVbg47aZJV9KMHMiuD6S1yd +4uw== X-Gm-Message-State: AOAM53078cCXqDmq3HEKX9N9NNlQho3cL2m2VgUxa3bZ+NF2TXI3Nz1C SedTQaFXca78/q3IX/4P32s= X-Google-Smtp-Source: ABdhPJy2fQOiX9zWns8jMREKPXt223Tj0JlcrT2AcIxeCkh7llbHxNJK6zeR9F4uCMc2Q1GEm+1DHg== X-Received: by 2002:a19:ac4d:: with SMTP id r13mr3842546lfc.360.1619804847028; Fri, 30 Apr 2021 10:47:27 -0700 (PDT) Received: from sovereign (broadband-37-110-65-23.ip.moscow.rt.ru. [37.110.65.23]) by smtp.gmail.com with ESMTPSA id a30sm345254lfi.47.2021.04.30.10.47.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Apr 2021 10:47:26 -0700 (PDT) Date: Fri, 30 Apr 2021 20:47:24 +0300 From: Dmitry Kozlyuk To: Narcisa Ana Maria Vasile 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: <20210430204724.1721a5ef@sovereign> In-Reply-To: <1617413948-10504-8-git-send-email-navasile@linux.microsoft.com> References: <1617057640-24301-2-git-send-email-navasile@linux.microsoft.com> <1617413948-10504-1-git-send-email-navasile@linux.microsoft.com> <1617413948-10504-8-git-send-email-navasile@linux.microsoft.com> X-Mailer: Claws Mail 3.17.6 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v6 07/10] 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" 2021-04-02 18:39 (UTC-0700), Narcisa Ana Maria Vasile: [...] > diff --git a/lib/librte_eal/include/rte_thread_types.h b/lib/librte_eal/include/rte_thread_types.h > index a884daf17..37bc7af2b 100644 > --- a/lib/librte_eal/include/rte_thread_types.h > +++ b/lib/librte_eal/include/rte_thread_types.h > @@ -7,9 +7,12 @@ > > #include > > +#define RTE_THREAD_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER > + I'd wrap this in #ifndef RTE_EXEC_ENV_WINDOWS, so that portable code couldn't accidentally rely on it. > #define EAL_THREAD_PRIORITY_NORMAL 0 > #define EAL_THREAD_PRIORITY_REALTIME_CIRTICAL 99 > > typedef pthread_t rte_thread_t; > +typedef pthread_mutex_t rte_thread_mutex_t; > > #endif /* _RTE_THREAD_TYPES_H_ */ > diff --git a/lib/librte_eal/windows/include/rte_windows_thread_types.h b/lib/librte_eal/windows/include/rte_windows_thread_types.h > index 8cb4b3856..47c6b2664 100644 > --- a/lib/librte_eal/windows/include/rte_windows_thread_types.h > +++ b/lib/librte_eal/windows/include/rte_windows_thread_types.h > @@ -11,5 +11,6 @@ > #define EAL_THREAD_PRIORITY_REALTIME_CIRTICAL THREAD_PRIORITY_TIME_CRITICAL > > typedef DWORD rte_thread_t; > +typedef CRITICAL_SECTION rte_thread_mutex_t; > > #endif /* _RTE_THREAD_TYPES_H_ */ You have to ensure that sizeof(rte_thread_mutex_t) is the same with both backends. MinGW's winpthread has "typedef void *pthread_mutex_t", while CRITICAL_SECTION is much larger. If you decide to make rte_thread_mutext_t a pointer on Windows, consider implementing RTE_THREAD_MUTEX_INITILIZER.