diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2026-03-01 17:29:29 +0000 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2026-03-01 17:29:29 +0000 |
| commit | 57c35143cf256d6770687aa55af760bcbe40b883 (patch) | |
| tree | 5ca4362c45372295957af48862bfcb15a10d9c59 | |
| parent | a676d598ff6286bdb64b2803dee515c1436aa3bb (diff) | |
| download | nissy-core-57c35143cf256d6770687aa55af760bcbe40b883.tar.gz nissy-core-57c35143cf256d6770687aa55af760bcbe40b883.zip | |
Better ifdefs yet
| -rw-r--r-- | src/utils/wrapthread.h | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/utils/wrapthread.h b/src/utils/wrapthread.h index e14a473..4ac72a6 100644 --- a/src/utils/wrapthread.h +++ b/src/utils/wrapthread.h | |||
| @@ -1,19 +1,18 @@ | |||
| 1 | #if THREADS == 1 | 1 | #if THREADS == 1 |
| 2 | #define WRAPTHREADS_NOTHREADS 1 | 2 | #define WRAPTHREAD_NOTHREADS 1 |
| 3 | #elif defined(__unix__) | 3 | #elif defined(__unix__) |
| 4 | #define WRAPTHREADS_PTHREADS 1 | 4 | #define WRAPTHREAD_PTHREADS 1 |
| 5 | #elif !defined(__STDC_NO_THREADS__) | ||
| 6 | #define WRAPTHREADS_C11THREADS 1 | ||
| 7 | #elif defined(__has_include) | 5 | #elif defined(__has_include) |
| 8 | #if __has_include(<pthreads.h>) | 6 | #if __has_include(<pthreads.h>) |
| 9 | #define WRAPTHREADS_PTHREADS 1 | 7 | #define WRAPTHREAD_PTHREADS 1 |
| 10 | #elif __has_include(<threads.h>) | 8 | #elif __has_include(<threads.h>) |
| 11 | #define WRAPTHREADS_C11THREADS 1 | 9 | #define WRAPTHREAD_C11THREADS 1 |
| 12 | #endif | 10 | #endif |
| 11 | #else | ||
| 12 | #define WRAPTHREAD_NOTHREADS 1 | ||
| 13 | #endif | 13 | #endif |
| 14 | 14 | ||
| 15 | #if WRAPTHREADS_PTHREADS | 15 | #if WRAPTHREAD_PTHREADS |
| 16 | |||
| 17 | #include <pthread.h> | 16 | #include <pthread.h> |
| 18 | 17 | ||
| 19 | #define wrapthread_atomic _Atomic | 18 | #define wrapthread_atomic _Atomic |
| @@ -34,8 +33,7 @@ | |||
| 34 | #define wrapthread_mutex_lock(a) pthread_mutex_lock(a) | 33 | #define wrapthread_mutex_lock(a) pthread_mutex_lock(a) |
| 35 | #define wrapthread_mutex_unlock(a) pthread_mutex_unlock(a) | 34 | #define wrapthread_mutex_unlock(a) pthread_mutex_unlock(a) |
| 36 | 35 | ||
| 37 | #elif WRAPTHREADS_C11THREADS | 36 | #elif WRAPTHREAD_C11THREADS |
| 38 | |||
| 39 | #include <threads.h> | 37 | #include <threads.h> |
| 40 | 38 | ||
| 41 | #define wrapthread_atomic _Atomic | 39 | #define wrapthread_atomic _Atomic |
