[libcxx-commits] [PATCH] D113069: [libcxx][SystemZ][z/OS] Update libcxx/src/random_shuffle.cpp to accommodate POSIX(OFF)

Daniel McIntosh via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Nov 4 19:06:22 PDT 2021


DanielMcIntosh-IBM updated this revision to Diff 384941.
DanielMcIntosh-IBM added a comment.

Update function names as a result of changes to D110349 <https://reviews.llvm.org/D110349>


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113069/new/

https://reviews.llvm.org/D113069

Files:
  libcxx/src/random_shuffle.cpp


Index: libcxx/src/random_shuffle.cpp
===================================================================
--- libcxx/src/random_shuffle.cpp
+++ libcxx/src/random_shuffle.cpp
@@ -25,9 +25,10 @@
 __rs_default::__rs_default()
 {
 #ifndef _LIBCPP_HAS_NO_THREADS
+  if (__libcpp_is_threading_api_enabled())
     __libcpp_mutex_lock(&__rs_mut);
 #endif
-    __c_ = 1;
+  __c_ = 1;
 }
 
 __rs_default::__rs_default(const __rs_default&)
@@ -38,10 +39,10 @@
 __rs_default::~__rs_default()
 {
 #ifndef _LIBCPP_HAS_NO_THREADS
-    if (--__c_ == 0)
-       __libcpp_mutex_unlock(&__rs_mut);
+  if (--__c_ == 0 && __libcpp_is_threading_api_enabled())
+    __libcpp_mutex_unlock(&__rs_mut);
 #else
-    --__c_;
+  --__c_;
 #endif
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113069.384941.patch
Type: text/x-patch
Size: 720 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20211105/3c063e13/attachment.bin>


More information about the libcxx-commits mailing list