On Tue, Oct 12, 2021 at 06:28:56PM +0200, Thomas Monjalon wrote: > 09/10/2021 09:41, Narcisa Ana Maria Vasile: > > From: Narcisa Vasile <navas...@microsoft.com> > > > > 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. > [...] > > --- 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? >
Agreed, I'll rename to RTE_MUTEX_INIT or something like this. Thanks!