summaryrefslogtreecommitdiffstats
path: root/libcxx/src/mutex.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/src/mutex.cpp')
-rw-r--r--libcxx/src/mutex.cpp5
1 files changed, 1 insertions, 4 deletions
diff --git a/libcxx/src/mutex.cpp b/libcxx/src/mutex.cpp
index 9f808ca5076..7226abc6a51 100644
--- a/libcxx/src/mutex.cpp
+++ b/libcxx/src/mutex.cpp
@@ -199,9 +199,6 @@ static __libcpp_mutex_t mut = _LIBCPP_MUTEX_INITIALIZER;
static __libcpp_condvar_t cv = _LIBCPP_CONDVAR_INITIALIZER;
#endif
-/// NOTE: Changes to flag are done via relaxed atomic stores
-/// even though the accesses are protected by a mutex because threads
-/// just entering 'call_once` concurrently read from flag.
void
__call_once(volatile unsigned long& flag, void* arg, void(*func)(void*))
{
@@ -238,7 +235,7 @@ __call_once(volatile unsigned long& flag, void* arg, void(*func)(void*))
__libcpp_mutex_unlock(&mut);
func(arg);
__libcpp_mutex_lock(&mut);
- __libcpp_relaxed_store(&flag, ~0ul);
+ __libcpp_atomic_store(&flag, ~0ul, _AO_Release);
__libcpp_mutex_unlock(&mut);
__libcpp_condvar_broadcast(&cv);
#ifndef _LIBCPP_NO_EXCEPTIONS
OpenPOWER on IntegriCloud