[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
Mon Nov 8 13:04:59 PST 2021


DanielMcIntosh-IBM updated this revision to Diff 385608.
DanielMcIntosh-IBM marked an inline comment as done.
DanielMcIntosh-IBM added a comment.

Rebase and update indentation to match the rest of the file


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,7 +25,8 @@
 __rs_default::__rs_default()
 {
 #ifndef _LIBCPP_HAS_NO_THREADS
-    __libcpp_mutex_lock(&__rs_mut);
+    if (__libcpp_is_threading_api_enabled())
+        __libcpp_mutex_lock(&__rs_mut);
 #endif
     __c_ = 1;
 }
@@ -38,8 +39,8 @@
 __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_;
 #endif


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113069.385608.patch
Type: text/x-patch
Size: 686 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20211108/7f271002/attachment.bin>


More information about the libcxx-commits mailing list