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

via libcxx-commits libcxx-commits at lists.llvm.org
Tue Sep 19 15:15:30 PDT 2023


Author: Louis Dionne
Date: 2023-09-19T18:15:26-04:00
New Revision: e7a7a1690139e1959ee70a45150ea62620d54e9c

URL: https://github.com/llvm/llvm-project/commit/e7a7a1690139e1959ee70a45150ea62620d54e9c
DIFF: https://github.com/llvm/llvm-project/commit/e7a7a1690139e1959ee70a45150ea62620d54e9c.diff

LOG: [libc++] Fix __threading_support when used with C11 threading (#66780)

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.

Added: 
    

Modified: 
    libcxx/include/__threading_support

Removed: 
    


################################################################################
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


        


More information about the libcxx-commits mailing list