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 916D8A04A7; Mon, 7 Feb 2022 17:03:08 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 78916410F3; Mon, 7 Feb 2022 17:03:08 +0100 (CET) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id C997B410EA for ; Mon, 7 Feb 2022 17:03:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1644249787; x=1675785787; h=from:to:cc:subject:date:message-id: content-transfer-encoding:mime-version; bh=fy9zBl/CdMaeOdr590+07RMds1JiCUmGzZOY6tgL4TI=; b=bXGf873+xyVcDA8wJtocYAJgopdOsKYcKCkXmVGtbD1hBvNgvmTjau8Q i7AeE4o75+S78f5Ey5f0lJv4x2a8cp2gmTo3HB8I8jt8cwUth3sTMH8KB ir6cyjFoX9Pz3LiOZwN79ImBn865j5szIzqKazU+gzc3OF2lfcREC0G54 OrZqP4UeY9bzPx7oxV5N5fyMKX76kHkk/Xxa3wXVZACG1zGdxxTJfhMAJ ceV0fcZgO+DVEFm6cIh7Tn0obvSYZdlrIL8KTq6CWZDbR7yeHrPakJoV7 FjLbix/d/ThbrLtnwUIgO4JMkKorDxuMEaNco8VwQBG/ceAIiCUOEX+E7 Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10250"; a="232308077" X-IronPort-AV: E=Sophos;i="5.88,350,1635231600"; d="scan'208";a="232308077" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Feb 2022 08:03:04 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,350,1635231600"; d="scan'208";a="540156921" Received: from fmsmsx606.amr.corp.intel.com ([10.18.126.86]) by orsmga008.jf.intel.com with ESMTP; 07 Feb 2022 08:03:04 -0800 Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Mon, 7 Feb 2022 08:03:03 -0800 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx608.amr.corp.intel.com (10.18.126.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20 via Frontend Transport; Mon, 7 Feb 2022 08:03:03 -0800 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (104.47.74.44) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.20; Mon, 7 Feb 2022 08:03:03 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZgIDWAmIqZXeyytVTlzKOysm5uZm7cfOvHwBEtCCi5xlfmq3xY06uP7MGRxcoBCp0ERg7W7RtgK491Rqp4JO8bT5xkOmv4k/T4qdI34zyUHNgHbTKCd7DPbgNTQg9wMtUuLb9V8D35Hpz2BLzi4rGolG+WuEOHTxNBYLzEEekF6nSuLZ1j/Z3D3CAT5ZFWEpQ4/1gQZN/fAw60cuE/FLNMK/dINhFx1MaXH9NfOSNckI0j67CnISTUK4jU/fuiz1m5bKZ27HuHdgZzgcyHjx5qhG4bDI0JVU8PLh4eigoIeyOWdqo/3xhwwS0VRu4rk6m9V0nOPVWRKzCiTqzzY8nQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=HZQTXtWeITI4NJS9bpmT0ch4AwLEoOjSf0hWQ4C21mA=; b=YIgDv1RQRmUHT11Ibvyz3I4Q3pfy1Qqzzy7aJN9c35y1hnfESKzfb+ZaFL16O+VXl38VblkLN78Ln2nb8wwXqImUldtx2vqmgcUIKGfVaEcQPhdyI22JAKvdCLxSMLKp6Irb+bN4+TCA0YFlpy9SMcJ482cVGsymHwOJPzWHsLX3GNrZXfB1ERPU6XK7nFbjc5tD5BGPqC6UAnDBGLfsY5WhUW6bMaLoDG6rqjLYjbKhart9w49Ih0AW/pRZumB+BHbSOjfe/Ws/E7h5tqsYd4Ml+/MHvM0haZOL4+d6L5GEjNsoS3PMLLpbexM5BlWianWtqGbry2bYkcSj9q6hVg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Received: from DM6PR11MB4491.namprd11.prod.outlook.com (2603:10b6:5:204::19) by PH7PR11MB5863.namprd11.prod.outlook.com (2603:10b6:510:135::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4951.14; Mon, 7 Feb 2022 16:02:54 +0000 Received: from DM6PR11MB4491.namprd11.prod.outlook.com ([fe80::8ccc:ed65:78fa:1b07]) by DM6PR11MB4491.namprd11.prod.outlook.com ([fe80::8ccc:ed65:78fa:1b07%4]) with mapi id 15.20.4951.019; Mon, 7 Feb 2022 16:02:54 +0000 From: "Ananyev, Konstantin" To: "navasile@linux.microsoft.com" CC: "Richardson, Bruce" , "david.marchand@redhat.com" , "dev@dpdk.org" , "dmitry.kozliuk@gmail.com" , "dmitrym@microsoft.com" , "khot@microsoft.com" , "navasile@microsoft.com" , "ocardona@microsoft.com" , "Kadam, Pallavi" , "roretzla@microsoft.com" , "talshn@nvidia.com" , "thomas@monjalon.net" Subject: Re: [PATCH v18 8/8] eal: implement functions for mutex management Thread-Topic: Re: [PATCH v18 8/8] eal: implement functions for mutex management Thread-Index: AdgcKrFXel+5rnjbRCWUDjl47QipCw== Date: Mon, 7 Feb 2022 16:02:54 +0000 Message-ID: Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.6.200.16 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 366f1605-afdf-457c-d1b2-08d9ea534cd8 x-ms-traffictypediagnostic: PH7PR11MB5863:EE_ x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7219; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 03fZWUg2ZB5rKytP4cV9q3YWRl5sy4i/X6NC8QAtZ2KwAeMRmxJVS1kW1nUYuPiMInwZHXT/bF5VsLtUYLDY9ecx0UO7F2g8QDG9BeQIbgpMiJBmVHmUOy/oFPCs2ew7SRlzRpl+FIFtyYqG4T3MJI3cj1hhCAoNu8fLVqcRK0BddNIYxQ8R9r7f1mYPlQfiS+V5ee5Fvn4C6SxYSJwGD7/SPZdxIh8jxT26GfvDG9I9Eax+Xhrlc0bsLxjeB+326YJT9gprpQ1rIxy2fZW8IMiF2Z17d/qWCnCL2+qxIw0KTUdX+yRfbIvsQkVpK5c9Sfpw0PMr152p7pUa1GBojpQAS0V4ghfztUyB1Ki5MzRJciXIPw+ADlvGexVaYpwTjhe+5EqWTr5//3tT/Oh/FukQ4hiGAlRJu6W1gddu0n005eXhRZpRzLAZPtoGBEJ5TNDMUff/+QKtfsTUBwRdJjS4W+gh1cCcJH9dr4OqYKCDMy5+776iReh7IjSB/BY4dAgyKqMfl6Lg0NoLFH2Mg4NeXJ/sAyg0/3wJgxNOujM8lpUh3f9eg1tlhdVhJGjNQ8O9/D8iAm2cQp8kh9G/O3a6wXydVe+2u7b8f4+PkbGEnQ0SpUA3yV9nktZGE5MT9/0+MJsmxtAzi5dzDoMCxfn1dyHU8qhjE7JKWR8cQpzJcilClru4UHWV1yRISrJDylDCI522C6YXAYkhtf7biw== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR11MB4491.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(54906003)(33656002)(316002)(6916009)(38070700005)(6506007)(7696005)(9686003)(76116006)(508600001)(52536014)(8936002)(8676002)(4326008)(64756008)(66446008)(66946007)(66556008)(66476007)(122000001)(5660300002)(7416002)(86362001)(82960400001)(55016003)(38100700002)(2906002)(186003)(26005)(71200400001)(83380400001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?PNMF6Y1vOC3v/kIooAL/eaeHE26hAbKBZ0TCWujThyJSz+1sFSae6vugcInM?= =?us-ascii?Q?XjkX2Urn+o1JHQQ/NaI24n+Dv4jcRAQsaO9lJSSeLjfX4OGtkJRTD12epFHP?= =?us-ascii?Q?l8tcHbu/tk20im0ji0SDFC8yY/fqVT51bqC231/UemFgYvD7F69eg+Eak7sj?= =?us-ascii?Q?3MRgRPV6s9ath+D5pjg7HIjQiaay9VBigi4T1sWYatGTo01HlSw8nWetqgpi?= =?us-ascii?Q?bI7nnBq0Iej/ZR1St9RAZO9/hFE0YdPe1AXpGMdlLfXVpZKIzsd8fFJGJ6MG?= =?us-ascii?Q?M9OTw/7eGlOA3qLHrNifYa5WiPjzGk7E67bqcTuInEMhp51PfT62049mvs7g?= =?us-ascii?Q?7NBtMEst3eVHNMzaccTThnU5Qh6BGoOEzdBpvWaek1PtVQxg1BVL2YHACBq+?= =?us-ascii?Q?GnuZ/4uuLSV5yz2LxWwtYMDOkbzhKUJI/h0/z/Vg4cMIKlmCV+DKsbrut+YZ?= =?us-ascii?Q?/51kk1achyjvDoE+p8HaQgkqlJznJ+x+Ecl0SssLjHc6d75ipdXXtpEBzw+O?= =?us-ascii?Q?1lGe/5Gh0XhxQBGwdd9MvgqIoKn/KAA0PakRqjXDUcNBmI2lpUCd+xERT1L2?= =?us-ascii?Q?qzU1biOgDI2vMLUsUGFXBxHdGaOkfhTJ96NMPvFObUsoJ+ZzjMUZ9/N8eoq5?= =?us-ascii?Q?J+ljk7a/sxK9OOkfeGYYxoHavSO/KFCQ/SqfMJhjfs8WIKfaAhTlimG9W6yB?= =?us-ascii?Q?xEchP5vp0G9AtXtCRfpLlSiC/lIOo1g0uWkhUJsL5cYkq4WI08Jyg2qBacim?= =?us-ascii?Q?JXSWSGMPIy7Zk5qR11EfRoiTTcGg4EPmWNL+cyEZXsUMi2cmd8hmRKY4FeQy?= =?us-ascii?Q?0rmd8cylooM+B9rz07Ouys4qqK4v0nEWj9jvP5ZCDjPv3CSU2gggyQ+9X47K?= =?us-ascii?Q?SjhXaardhnsR4FF3Ux26kPIiF7C+BOP75aGqEqoqf5J884vM+/DHCVF3288R?= =?us-ascii?Q?4y5YB0Z0ac43t1NobeDpEskfce8Ag3tY3DLtI4okNxvA7hPMBi+46ptZMIV0?= =?us-ascii?Q?D0SWpN9Yv9Yb5jD6WMLoCj3w3XXa8ctn2/048haOM36GuNl+oEsE+dO369NM?= =?us-ascii?Q?FkHnwMXu3PIsdqLWgliwPjtEWu3ZMZeyWzu/4/5M55JJRhv/aM/uqE/SwfbB?= =?us-ascii?Q?YnW2eFWTeU2xj7T8TfEHKBNks03G8KRvX1gfhYOBVcE7uauGJuhmVLThDI9m?= =?us-ascii?Q?jpbtONxgDvhbZ36XnVBx0+V11ZUtzXo8ZT6e6xFD8way8GN7SHRSz24Ulihe?= =?us-ascii?Q?STD/DJH4sgfboDIqLqL/xQWd7MUOcQaa9v9mQ05Uy7e3euBU4x8xKCisLpRl?= =?us-ascii?Q?kUgpgCt8KcVvFZw97DBc+0JaZ/l9mbMwFfSIXotyLPeQ6fiDwhRfeTXf9mEg?= =?us-ascii?Q?M3NO/ggK8uzQGERIgBJx98pxasgVOvrGP8lnCh/JmpkLAekaFP49a0/kXr4r?= =?us-ascii?Q?rAvW+QyZrR43UOKX9cBxg0ww7knKuIpYgfn7ubePQDjgbomsuCO+NPXKwLIP?= =?us-ascii?Q?7iplg1xx/GlK50wLs1/OTtrPsSeA53BnR0nm6f3vqY5lpB5DIU8p7VQrgQOP?= =?us-ascii?Q?z7N1M6oUWwXNEZArp08CaWE1O4a+ACyRBp4PI6wbaSBpK5wf4oIUXrm8xIzL?= =?us-ascii?Q?PnZ9X6WdIdaHzY+1xV4FmWo2eg4ojKhG6ihHQ/ZDL6XfAwyfDqKOOfJz4o2u?= =?us-ascii?Q?IoJdqA=3D=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR11MB4491.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 366f1605-afdf-457c-d1b2-08d9ea534cd8 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Feb 2022 16:02:54.1005 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 6M9yOjO1ob8HF3TAYsxBL+LwWinXakY8SpDWVzvKwS2Sm0IrfdSxRky749T1zoLKLTfNhOFqY4ECPDD/pE4oNL1OQTcGZ+qycSF998PLbHU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR11MB5863 X-OriginatorOrg: intel.com 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 > Add functions for mutex init, destroy, lock, unlock, trylock. >=20 > Windows does not have a static initializer. Initialization > is only done through InitializeCriticalSection(). To overcome this, > RTE_INIT_MUTEX macro is added to replace static initialization > of mutexes. The macro calls rte_thread_mutex_init(). >=20 > Add unit tests to verify that the mutex correctly locks/unlocks > and protects the data. Check both static and dynamic mutexes. > Signed-off-by: Narcisa Vasile Few comments from me below. I am not sure was such approach already discussed, if so - apologies for repetition.=20 > --- > app/test/test_threads.c | 106 +++++++++++++++++++++++++++++++++++ > lib/eal/common/rte_thread.c | 69 +++++++++++++++++++++++ > lib/eal/include/rte_thread.h | 85 ++++++++++++++++++++++++++++ > lib/eal/version.map | 5 ++ > lib/eal/windows/rte_thread.c | 64 +++++++++++++++++++++ > 5 files changed, 329 insertions(+) >=20 > }; > diff --git a/lib/eal/common/rte_thread.c b/lib/eal/common/rte_thread.c > index d30a8a7ca3..4a9a1b6e07 100644 > --- a/lib/eal/common/rte_thread.c > +++ b/lib/eal/common/rte_thread.c > @@ -309,6 +309,75 @@ rte_thread_detach(rte_thread_t thread_id) > return pthread_detach((pthread_t)thread_id.opaque_id); > } >=20 > +int > +rte_thread_mutex_init(rte_thread_mutex *mutex) Don't we need some sort of mutex_attr here too? To be able to create PROCESS_SHARED mutexes? > +{ > + int ret =3D 0; > + pthread_mutex_t *m =3D NULL; > + > + RTE_VERIFY(mutex !=3D NULL); > + > + m =3D calloc(1, sizeof(*m)); But is that what we really want for the mutexes? It means actual mutex will always be allocated on process heap, away from the data it is supposed to guard. Even if we'll put performance considerations away, that wouldn't work for MP case. Is that considered as ok? > + if (m =3D=3D NULL) { > + RTE_LOG(DEBUG, EAL, "Unable to initialize mutex. Insufficient memory!\= n"); > + ret =3D ENOMEM; > + goto cleanup; > + } > + > + ret =3D pthread_mutex_init(m, NULL); > + if (ret !=3D 0) { > + RTE_LOG(DEBUG, EAL, "Failed to init mutex. ret =3D %d\n", ret); > + goto cleanup; > + } > + > + mutex->mutex_id =3D m; > + m =3D NULL; > + > +cleanup: > + free(m); > + return ret; > +} > + > +int > +rte_thread_mutex_lock(rte_thread_mutex *mutex) > +{ > + RTE_VERIFY(mutex !=3D NULL); > + > + return pthread_mutex_lock((pthread_mutex_t *)mutex->mutex_id); > +} > + > +int > +rte_thread_mutex_unlock(rte_thread_mutex *mutex) > +{ > + RTE_VERIFY(mutex !=3D NULL); > + > + return pthread_mutex_unlock((pthread_mutex_t *)mutex->mutex_id); > +} > + > +int > +rte_thread_mutex_try_lock(rte_thread_mutex *mutex) > +{ > + RTE_VERIFY(mutex !=3D NULL); > + > + return pthread_mutex_trylock((pthread_mutex_t *)mutex->mutex_id); > +} > + > +int > +rte_thread_mutex_destroy(rte_thread_mutex *mutex) > +{ > + int ret =3D 0; > + RTE_VERIFY(mutex !=3D NULL); > + > + ret =3D pthread_mutex_destroy((pthread_mutex_t *)mutex->mutex_id); > + if (ret !=3D 0) > + RTE_LOG(DEBUG, EAL, "Unable to destroy mutex, ret =3D %d\n", ret); > + > + free(mutex->mutex_id); > + mutex->mutex_id =3D NULL; > + > + return ret; > +} > + > int > rte_thread_barrier_init(rte_thread_barrier *barrier, int count) > { > diff --git a/lib/eal/include/rte_thread.h b/lib/eal/include/rte_thread.h > index 7c84e32988..09a5fd8add 100644 > --- a/lib/eal/include/rte_thread.h > +++ b/lib/eal/include/rte_thread.h > @@ -54,6 +54,25 @@ typedef struct { >=20 > #endif /* RTE_HAS_CPUSET */ >=20 > +#define RTE_DECLARE_MUTEX(private_lock) rte_thread_mutex privat= e_lock > + > +#define RTE_DEFINE_MUTEX(private_lock)\ > +RTE_INIT(__rte_ ## private_lock ## _init)\ > +{\ > + RTE_VERIFY(rte_thread_mutex_init(&private_lock) =3D=3D 0);\ > +} > + > +#define RTE_INIT_MUTEX(private_lock)\ > +static RTE_DECLARE_MUTEX(private_lock);\ > +RTE_DEFINE_MUTEX(private_lock) Hmm, but that way we can't use RTE_INIT_MUTEX() within functions, right? > + > +/** > + * Thread mutex representation. > + */ > +typedef struct rte_thread_mutex_tag { > + void *mutex_id; /**< mutex identifier */ > +} rte_thread_mutex; I wonder can't we have something like that instead: for posix: typedef pthread_mutex_t rte_thread_mutex_t; for windows:=20 typedef struct rte_thread_mutex { int initialized; CRITICAL_SECTION cs; } rte_thread_mutex_t; Then for posix: #define RTE_INIT_MUTEX(mx) do {\ *(mx) =3D PTHREAD_MUTEX_INITIALIZER; \ } while(0) #define RTE_DESTROY_MUTEX(mx) do {} while (0); /*empty */ For windows: #define RTE_INIT_MUTEX(mx) do {\ If ((mx)->initialized =3D=3D 0) { InitializeCriticalSection((mx)->cs); (mx)->initialized =3D 1; } } while (0) #define RTE_DESTROY_MUTEX(mx) do { if ((mx)->initialized !=3D 0) { \ DeleteCriticalSection((mx)->cs); } } while (0) That way we'll keep ability for static initialization on posix systems, and would avoid need to allocate actual mutex object from the heap.=20 > /** > * Returned by rte_thread_barrier_wait() when call is successful. > */ > @@ -314,6 +333,72 @@ __rte_experimental > int rte_thread_set_priority(rte_thread_t thread_id, > enum rte_thread_priority priority); >=20 > +/** > + * Initializes a mutex. > + * > + * @param mutex > + * The mutex to be initialized. > + * > + * @return > + * On success, return 0. > + * On failure, return a positive errno-style error number. > + */ > +__rte_experimental > +int rte_thread_mutex_init(rte_thread_mutex *mutex); > + > +/** > + * Locks a mutex. > + * > + * @param mutex > + * The mutex to be locked. > + * > + * @return > + * On success, return 0. > + * On failure, return a positive errno-style error number. > + */ > +__rte_experimental > +int rte_thread_mutex_lock(rte_thread_mutex *mutex); > + > +/** > + * Unlocks a mutex. > + * > + * @param mutex > + * The mutex to be unlocked. > + * > + * @return > + * On success, return 0. > + * On failure, return a positive errno-style error number. > + */ > +__rte_experimental > +int rte_thread_mutex_unlock(rte_thread_mutex *mutex); > + > +/** > + * Tries to lock a mutex.If the mutex is already held by a different thr= ead, > + * the function returns without blocking. > + * > + * @param mutex > + * The mutex that will be acquired, if not already locked. > + * > + * @return > + * On success, if the mutex is acquired, return 0. > + * On failure, return a positive errno-style error number. > + */ > +__rte_experimental > +int rte_thread_mutex_try_lock(rte_thread_mutex *mutex); > + > +/** > + * Releases all resources associated with a mutex. > + * > + * @param mutex > + * The mutex to be uninitialized. > + * > + * @return > + * On success, return 0. > + * On failure, return a positive errno-style error number. > + */ > +__rte_experimental > +int rte_thread_mutex_destroy(rte_thread_mutex *mutex); > + > /** > * Initializes a synchronization barrier. > *