[PATCH] D11781: Refactored pthread usage in libcxx

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 18 23:43:00 PDT 2015


EricWF added a comment.

Added more inline comments.


================
Comment at: include/__mutex_base:36
@@ -35,3 +37,3 @@
 #else
-     mutex() _NOEXCEPT {__m_ = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER;}
 #endif
----------------
Why was the cast insignificant?

================
Comment at: include/__mutex_base:275
@@ -274,3 +277,3 @@
 #else
-    condition_variable() {__cv_ = (pthread_cond_t)PTHREAD_COND_INITIALIZER;}
 #endif
----------------
Why was the cast insignificant? 

================
Comment at: include/thread:412
@@ -411,3 +413,6 @@
 
-_LIBCPP_FUNC_VIS void sleep_for(const chrono::nanoseconds& ns);
 
----------------
I'm 99% this is an ABI break. Don't inline this function and make the change within the definition

================
Comment at: include/type_traits:222
@@ -221,3 +221,3 @@
 
-template <class _Tp>
-struct __identity { typedef _Tp type; };
+template <class T>
+struct __identity { typedef T type; };
----------------
This change seems to have snuck in.

================
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
----------------
I think this prevents __rs_mut from being initialized during constant initialization. (http://en.cppreference.com/w/cpp/language/constant_initialization)

================
Comment at: src/memory.cpp:130
@@ -129,3 +129,1 @@
 static const std::size_t __sp_mut_count = 16;
-static pthread_mutex_t mut_back_imp[__sp_mut_count] =
-{
----------------
I have no idea what is going on here. Do you understand what this code was trying to do?


Repository:
  rL LLVM

http://reviews.llvm.org/D11781





More information about the cfe-commits mailing list