[v3] use NSDMI in C++11 mutex types

François Dumont frs.dumont@gmail.com
Wed Oct 26 18:58:00 GMT 2011


On 10/25/2011 01:26 AM, Jonathan Wakely wrote:
>         PR libstdc++/49894
>          * include/std/mutex (__mutex_base,__recursive_mutex_base): Define new
>          base classes to manage construction/destruction of native mutexes,
>          using NSDMI when INIT macros are defined.
>          (mutex,recursive_mutex,timed_mutex,recursive_timed_mutex): Derive from
>          new base classes.
>          * include/std/condition_variable (condition_variable): Use NSDMI when
>          INIT macro is defined. Use noexcept.
>          * src/condition_variable.cc (condition_variable): Explicitly-default
>          constructor/destructor when using NSDMI. Use noexcept.
>          (condition_variable_any): Likewise.
>
> Tested x86_64-linux, committed to trunk.
     This is surely a naive remark as it is already the way the code is 
written and I haven't taken time to check the code in detail but there 
is something that surprised me in this patch. The __GTHREAD_MUTEX_INIT 
has also an impact on the definition of the destructor. Shouldn't the 
__gthread_mutex_destroy for __mutex_base or the _S_destroy for 
__recursive_mutex_base be called no matter how the _M_mutex has been 
created ?

François



More information about the Libstdc++ mailing list