[libcxx-commits] [libcxx] [libc++] Fix __threading_support when used with C11 threading (PR #66780)

via libcxx-commits libcxx-commits at lists.llvm.org
Tue Sep 19 07:37:56 PDT 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

<details>
<summary>Changes</summary>

Since we are defining these typedefs inside namespace std, we need to refer to ::once_flag (the C Standard Library version). Otherwise 'once_flag' refers to 'std::once_flag', and that's not something we can pass to the C Standard Library '::call_once()' function later on.

---
Full diff: https://github.com/llvm/llvm-project/pull/66780.diff


1 Files Affected:

- (modified) libcxx/include/__threading_support (+1-1) 


``````````diff
diff --git a/libcxx/include/__threading_support b/libcxx/include/__threading_support
index eaa402abae351b6..ccbcc652d9e50a6 100644
--- a/libcxx/include/__threading_support
+++ b/libcxx/include/__threading_support
@@ -102,7 +102,7 @@ typedef cnd_t __libcpp_condvar_t;
 #define _LIBCPP_CONDVAR_INITIALIZER {}
 
 // Execute once
-typedef once_flag __libcpp_exec_once_flag;
+typedef ::once_flag __libcpp_exec_once_flag;
 #define _LIBCPP_EXEC_ONCE_INITIALIZER ONCE_FLAG_INIT
 
 // Thread id

``````````

</details>


https://github.com/llvm/llvm-project/pull/66780


More information about the libcxx-commits mailing list