On Tue, Feb 08, 2022 at 02:21:49AM +0000, Ananyev, Konstantin wrote:
> 
> 
> > > +
> > > +/**
> > > + * Thread mutex representation.
> > 
> 
> Actually, please scrap that comment.
> Obviously it wouldn't work for static variables, 
> and doesn't make much sense.
> Though few thoughts remain:
> for posix we probably don't need an indirection and
> rte_thread_mutex can be just typedef of pthread_mutex_t.
> also for posix we don't need RTE_INIT constructor for each
> static mutex initialization.
> Something like:
> #define RTE_STATIC_INITIALIZED_MUTEX(mx) \
>       rte_thread_mutex_t mx = PTHREAD_MUTEX_INITIALIZER
> should work, I think.
> Konstantin

Thank you for reviewing, Konstantin!
Some context for the current representation of mutex
can be found in v9, patch 7/10 of this patchset.

Originally we've typedef'ed the pthread_mutex_t on POSIX, just
like you are suggesting here.
However, on Windows there's no static initializer similar to the pthread
one. Still, we want ABI compatibility and same thread behavior between
platforms. The most elegant solution we found was the current representation,
as suggested by Dmitry K.

I will address your other comments on the other thread.

Link to v9: 
http://patchwork.dpdk.org/project/dpdk/patch/1622850274-6946-8-git-send-email-navas...@linux.microsoft.com/
> 
> 

Reply via email to