[PATCH] D19412: [libcxx] Refactor pthread usage - II

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Thu May 5 18:09:47 PDT 2016


EricWF accepted this revision.
EricWF added a comment.
This revision is now accepted and ready to land.

LGTM after the minor fixes. Thank you for the patch.


================
Comment at: include/__threading_support:38
@@ +37,3 @@
+{
+    pthread_mutexattr_t attr;
+    int ec = pthread_mutexattr_init(&attr);
----------------
`ec` -> `__ec`.

================
Comment at: include/__threading_support:125
@@ +124,3 @@
+inline _LIBCPP_ALWAYS_INLINE
+int __libcpp_thread_id_equal(__libcpp_thread_id t1, __libcpp_thread_id t2)
+{
----------------
Let's make the return type bool so it's clear.

================
Comment at: include/__threading_support:127
@@ +126,3 @@
+{
+    return pthread_equal(t1, t2) != 0 ? 1 : 0;
+}
----------------
`return pthread_equal(t1, t2) != 0;`

================
Comment at: include/__threading_support:132
@@ +131,3 @@
+inline _LIBCPP_ALWAYS_INLINE
+int __libcpp_thread_id_less(__libcpp_thread_id t1, __libcpp_thread_id t2)
+{
----------------
Make the return type `bool`.

================
Comment at: include/__threading_support:134
@@ +133,3 @@
+{
+    return t1 < t2 ? 1 : 0;
+}
----------------
`return t1 < t2; `

================
Comment at: include/thread:200
@@ -198,3 +199,3 @@
     pointer __p = get();
-    pthread_setspecific(__key_, 0);
+    __libcpp_tl_set(__key_, 0);
     return __p;
----------------
Nit: Use `nullptr`.


http://reviews.llvm.org/D19412





More information about the cfe-commits mailing list