aboutsummaryrefslogtreecommitdiff
path: root/libcxx/src/call_once.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/src/call_once.cpp')
-rw-r--r--libcxx/src/call_once.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/libcxx/src/call_once.cpp b/libcxx/src/call_once.cpp
index 5744347..a398eae 100644
--- a/libcxx/src/call_once.cpp
+++ b/libcxx/src/call_once.cpp
@@ -9,7 +9,7 @@
#include <__mutex/once_flag.h>
#include <__utility/exception_guard.h>
-#ifndef _LIBCPP_HAS_NO_THREADS
+#if _LIBCPP_HAS_THREADS
# include <__thread/support.h>
#endif
@@ -23,13 +23,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// call into dispatch_once_f instead of here. Relevant radar this code needs to
// keep in sync with: 7741191.
-#ifndef _LIBCPP_HAS_NO_THREADS
+#if _LIBCPP_HAS_THREADS
static constinit __libcpp_mutex_t mut = _LIBCPP_MUTEX_INITIALIZER;
static constinit __libcpp_condvar_t cv = _LIBCPP_CONDVAR_INITIALIZER;
#endif
void __call_once(volatile once_flag::_State_type& flag, void* arg, void (*func)(void*)) {
-#if defined(_LIBCPP_HAS_NO_THREADS)
+#if !_LIBCPP_HAS_THREADS
if (flag == once_flag::_Unset) {
auto guard = std::__make_exception_guard([&flag] { flag = once_flag::_Unset; });
@@ -39,7 +39,7 @@ void __call_once(volatile once_flag::_State_type& flag, void* arg, void (*func)(
guard.__complete();
}
-#else // !_LIBCPP_HAS_NO_THREADS
+#else // !_LIBCPP_HAS_THREADS
__libcpp_mutex_lock(&mut);
while (flag == once_flag::_Pending)
@@ -64,7 +64,7 @@ void __call_once(volatile once_flag::_State_type& flag, void* arg, void (*func)(
__libcpp_mutex_unlock(&mut);
}
-#endif // !_LIBCPP_HAS_NO_THREADS
+#endif // !_LIBCPP_HAS_THREADS
}
_LIBCPP_END_NAMESPACE_STD