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

Jon Roelofs jonathan at codesourcery.com
Sat May 31 07:43:30 PDT 2014


mclow, the motivation for this is for bare-metal systems where we don't have threads.

The other alternative would be to write no-op shims around all of these primitives, but that seems like it would be a lot of mess for very little benefit.

================
Comment at: sources/cxx-stl/llvm-libc++/libcxx/include/shared_mutex:419
@@ -416,1 +418,3 @@
 
+#endif  // _LIBC_HAS_PTHREADS
+
----------------
line should read:

#endif // !_LIBCPP_SINGLE_THREADED

================
Comment at: sources/cxx-stl/llvm-libc++/libcxx/src/memory.cpp:175
@@ -174,3 +174,3 @@
 
-#endif // __has_feature(cxx_atomic)
+#endif // __has_feature(cxx_atomic) && LIBCPP_HAS_PTHREADS
 
----------------
line should read:

#endif // __has_feature(cxx_atomic) && !_LIBCPP_SINGLE_THREADED

http://reviews.llvm.org/D3969






More information about the cfe-commits mailing list