|
| 1 | +Backport scipopt/scip@cc917e07: prefix tinycthread once_flag/call_once |
| 2 | +with TNY_ to avoid clash with C11 <threads.h>. Drop when included in a |
| 3 | +BCR scip release > 9.2.3. |
| 4 | + |
| 5 | +diff --git a/src/tinycthread/tinycthread.c b/src/tinycthread/tinycthread.c |
| 6 | +--- a/src/tinycthread/tinycthread.c |
| 7 | ++++ b/src/tinycthread/tinycthread.c |
| 8 | +@@ -895,7 +895,7 @@ int _tthread_timespec_get(struct timespec *ts, int base) |
| 9 | + #endif /* _TTHREAD_EMULATE_TIMESPEC_GET_ */ |
| 10 | + |
| 11 | + #if defined(_TTHREAD_WIN32_) |
| 12 | +-void call_once(once_flag *flag, void (*func)(void)) |
| 13 | ++void TNY_call_once(TNY_once_flag *flag, void (*func)(void)) |
| 14 | + { |
| 15 | + /* The idea here is that we use a spin lock (via the |
| 16 | + InterlockedCompareExchange function) to restrict access to the |
| 17 | +diff --git a/src/tinycthread/tinycthread.h b/src/tinycthread/tinycthread.h |
| 18 | +--- a/src/tinycthread/tinycthread.h |
| 19 | ++++ b/src/tinycthread/tinycthread.h |
| 20 | +@@ -447,11 +447,11 @@ int tss_set(tss_t key, void *val); |
| 21 | + typedef struct { |
| 22 | + LONG volatile status; |
| 23 | + CRITICAL_SECTION lock; |
| 24 | +- } once_flag; |
| 25 | +- #define ONCE_FLAG_INIT {0,} |
| 26 | ++ } TNY_once_flag; |
| 27 | ++ #define TNY_ONCE_FLAG_INIT {0,} |
| 28 | + #else |
| 29 | +- #define once_flag pthread_once_t |
| 30 | +- #define ONCE_FLAG_INIT PTHREAD_ONCE_INIT |
| 31 | ++ #define TNY_once_flag pthread_once_t |
| 32 | ++ #define TNY_ONCE_FLAG_INIT PTHREAD_ONCE_INIT |
| 33 | + #endif |
| 34 | + |
| 35 | + /** Invoke a callback exactly once |
| 36 | +@@ -460,9 +460,9 @@ int tss_set(tss_t key, void *val); |
| 37 | + * @param func Callback to invoke. |
| 38 | + */ |
| 39 | + #if defined(_TTHREAD_WIN32_) |
| 40 | +- void call_once(once_flag *flag, void (*func)(void)); |
| 41 | ++ void TNY_call_once(TNY_once_flag *flag, void (*func)(void)); |
| 42 | + #else |
| 43 | +- #define call_once(flag,func) pthread_once(flag,func) |
| 44 | ++ #define TNY_call_once(flag,func) pthread_once(flag,func) |
| 45 | + #endif |
| 46 | + |
| 47 | + #ifdef __cplusplus |
0 commit comments