diff options
author | Nikolas Klauser <nikolasklauser@berlin.de> | 2024-11-06 10:39:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-06 10:39:19 +0100 |
commit | c6f3b7bcd0596d30f8dabecdfb9e44f9a07b6e4c (patch) | |
tree | dbfd623fea1771448ff564d5fc4221db7fca2f84 /libcxx/src/call_once.cpp | |
parent | 5acc4a3dc0e2145d2bfef47f1543bb291c2b866a (diff) | |
download | llvm-c6f3b7bcd0596d30f8dabecdfb9e44f9a07b6e4c.zip llvm-c6f3b7bcd0596d30f8dabecdfb9e44f9a07b6e4c.tar.gz llvm-c6f3b7bcd0596d30f8dabecdfb9e44f9a07b6e4c.tar.bz2 |
[libc++] Refactor the configuration macros to being always defined (#112094)
This is a follow-up to #89178. This updates the `<__config_site>`
macros.
Diffstat (limited to 'libcxx/src/call_once.cpp')
-rw-r--r-- | libcxx/src/call_once.cpp | 10 |
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 |