[PATCH] [libc++] Allow libc++ to be built on systems without POSIX threads

Jon Roelofs jonathan at codesourcery.com
Thu Aug 21 16:11:09 PDT 2014


================
Comment at: src/mutex.cpp:224-233
@@ -218,9 +223,11 @@
 void
 __call_once(volatile unsigned long& flag, void* arg, void(*func)(void*))
 {
+#ifndef _LIBCPP_HAS_NO_THREADS
     pthread_mutex_lock(&mut);
     while (flag == 1)
         pthread_cond_wait(&cv, &mut);
+#endif // !_LIBCPP_HAS_NO_THREADS
     if (flag == 0)
     {
 #ifndef _LIBCPP_NO_EXCEPTIONS
----------------
Eric Fiselier wrote:
> Wouldn't it be a lot cleaner to just separate the two implementation entirely instead of interweaving them like this?
Sigh. Yes. *hits head on desk*. Why did I do it like that?

http://reviews.llvm.org/D3969






More information about the cfe-commits mailing list