pthread_mutex_t initializer idiom
Peter Dimov
pdimov@mmltd.net
Fri Sep 8 11:10:00 GMT 2006
Benjamin Kosnik wrote:
> I'm still trying to unify some of the atomics and concurrency code,
> and remove duplicates.
>
> I see this idiom a lot:
>
> __gthread_mutex_t temp = __GTHREAD_MUTEX_INIT;
> _M_mutex = temp;
>
> Can somebody explain to me why we are doing this instead of:
>
> _M_mutex = __GTHREAD_MUTEX_INIT;
>
> ?
It is presumably to cover the case where __GTHREAD_MUTEX_INIT expands to
something like { 0, 0 }.
More information about the Libstdc++
mailing list