Thread (290 messages) flat view 290 messages, 13 authors, 2022-04-12

Re: [dpdk-dev] [PATCH v16 7/9] eal: implement functions for mutex management

From: Thomas Monjalon <hidden>
Date: 2021-10-12 16:29:04

09/10/2021 09:41, Narcisa Ana Maria Vasile:
From: Narcisa Vasile <redacted>

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.
[...]
quoted hunk ↗ jump to hunk
--- 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?

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help