[PATCH] D11781: Refactored pthread usage in libcxx

David Chisnall via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 6 06:37:16 PDT 2015


theraven added inline comments.

================
Comment at: include/__mutex_base:246
@@ -266,3 +245,3 @@
 
-class _LIBCPP_TYPE_VIS condition_variable
+class _LIBCPP_TYPE_VIS condition_variable : private __libcxx_support::condition_variable
 {
----------------
Does this change the ABI for a mutex on *NIX platforms?  We can't change the class layout for existing platforms (though we can indirect things via typedefs).

================
Comment at: include/mutex:182
@@ -181,2 +181,3 @@
 #endif
-#include <sched.h>
+#ifndef _WIN32
+#include <support/pthread/mutex.hpp>
----------------
As above, there should probably be in a cross-platform support file that includes these.  In particular, not-win32 is not the correct condition for uses-pthreads.  We should probably have something in __config that determines the thread library to use.  It would be quite nice to have a C11 thread back end, for example (though most implementations currently wrap pthreads).

================
Comment at: include/mutex:269
@@ -285,3 +268,3 @@
 bool
 recursive_timed_mutex::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t)
 {
----------------
I didn't realise this idiocy made it into C++11, I thought it was confined to C11.  Locking a mutex using anything other than time intervals on the monotonic time source is a great way of producing non-working programs.  We should probably warn if anyone actually calls this...


Repository:
  rL LLVM

http://reviews.llvm.org/D11781





More information about the cfe-commits mailing list