commit 6619a65

uint  ·  2026-05-04 09:54:22 +0000 UTC
parent 4e7573b
tinycthread: avoid once_flag, call_once conflicts with glibc
2 files changed,  +6, -3
+1, -1
 1@@ -22,8 +22,8 @@ freely, subject to the following restrictions:
 2     distribution.
 3 */
 4 
 5-#include "tinycthread.h"
 6 #include <stdlib.h>
 7+#include "tinycthread.h"
 8 
 9 /* Platform specific includes */
10 #if defined(_TTHREAD_POSIX_)
+5, -2
 1@@ -457,7 +457,7 @@ int tss_set(tss_t key, void *val);
 2   } once_flag;
 3   #define ONCE_FLAG_INIT {0,}
 4 #else
 5-  #define once_flag pthread_once_t
 6+  typedef pthread_once_t once_flag;
 7   #define ONCE_FLAG_INIT PTHREAD_ONCE_INIT
 8 #endif
 9 
10@@ -469,7 +469,10 @@ int tss_set(tss_t key, void *val);
11 #if defined(_TTHREAD_WIN32_)
12   void call_once(once_flag *flag, void (*func)(void));
13 #else
14-  #define call_once(flag,func) pthread_once(flag,func)
15+  static inline void call_once(once_flag *flag, void (*func)(void))
16+  {
17+    (void)pthread_once(flag, func);
18+  }
19 #endif
20 
21 #ifdef __cplusplus