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?