This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[c++0x] mutex and condition variable initializers


I realised recently that in C++0x mode the new uniform initialization
syntax allows this to work for the posix thread model:

mutex() : _M_mutex __GTHREAD_MUTEX_INIT
{ }

instead of

mutex()
{
   __native_type __tmp = __GTHREAD_MUTEX_INIT;
  _M_mutex = __tmp;
}


On most (all?) pthreads implementations it expands to something like
_M_mutex{ 0,... } which is a valid initialization in C++0x.  The same
applies to std::condition_variable and __GTHREAD_COND_INIT.

Would it be worth adding a configure check to see if that works with
the chosen threading model and using it when possible?

Jonathan


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]