rmaprath added inline comments. ================ Comment at: src/algorithm.cpp:51 @@ -50,3 +50,3 @@ #ifndef _LIBCPP_HAS_NO_THREADS -static pthread_mutex_t __rs_mut = PTHREAD_MUTEX_INITIALIZER; +static mutex __rs_mut; #endif ---------------- bcraig wrote: > rmaprath wrote: > > mclow.lists wrote: > > > What happened to the initializer here? > > I'm expecting the constructor of `mutex` to be run here at load time > > (before `main`). Note that this a libc++ mutex rather than a pthreads mutex > > (which does not required a constructor call like this). Would that be too > > much of an overhead? > std::mutex's default ctor is constexpr. As long as the compiler supports > constexpr, this initialization shouldn't require runtime code. Missed that!. The same applied to std::condition_variable (used below). From the sources it looks like we do cater for compilers that do not support `constexpr`, so for those compilers it would depend on how clever they are in optimizing out this kind of trivial constructor calls.
http://reviews.llvm.org/D19412 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits