aboutsummaryrefslogtreecommitdiff
path: root/src/utils/wrapthread.h
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2025-08-12 09:36:36 +0100
committerSebastiano Tronto <sebastiano@tronto.net>2025-08-12 09:36:36 +0100
commit50bd8f0f568120e554d416f474cc72247d0b3240 (patch)
tree236b8ebed5af17f8220981deffd69b97f0d08fe7 /src/utils/wrapthread.h
parent315d0f118f3d5ec2578249182f7b0eebf99d2943 (diff)
parentb36ed11e322152ff9ab813af78a08c35b42d5f94 (diff)
downloadnissy-core-50bd8f0f568120e554d416f474cc72247d0b3240.tar.gz
nissy-core-50bd8f0f568120e554d416f474cc72247d0b3240.zip
Merge branch 'master' of https://github.com/sebastianotronto/nissy-core into windows
Diffstat (limited to 'src/utils/wrapthread.h')
-rw-r--r--src/utils/wrapthread.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/utils/wrapthread.h b/src/utils/wrapthread.h
new file mode 100644
index 0000000..482b67f
--- /dev/null
+++ b/src/utils/wrapthread.h
@@ -0,0 +1,37 @@
1#if THREADS == 1
2
3#define wrapthread_atomic
4
5#define wrapthread_define_var_thread_t(x) char x; (void)(x)
6#define wrapthread_define_var_mutex_t(x) char x; (void)(x)
7#define wrapthread_define_struct_thread_t(x) char x
8#define wrapthread_define_struct_mutex_t(x) char x
9
10#define wrapthread_define_if_threads(T, x) T x; (void)(x)
11
12#define wrapthread_create(a, b, c, d) c(d)
13#define wrapthread_join(a, b)
14#define wrapthread_mutex_init(a, b)
15#define wrapthread_mutex_lock(a)
16#define wrapthread_mutex_unlock(a)
17
18#else
19
20#include <pthread.h>
21
22#define wrapthread_atomic _Atomic
23
24#define wrapthread_define_var_thread_t(x) pthread_t x
25#define wrapthread_define_var_mutex_t(x) pthread_mutex_t x
26#define wrapthread_define_struct_thread_t(x) pthread_t x
27#define wrapthread_define_struct_mutex_t(x) pthread_mutex_t x
28
29#define wrapthread_define_if_threads(T, x) T x
30
31#define wrapthread_create(a, b, c, d) pthread_create(a, b, c, d)
32#define wrapthread_join(a, b) pthread_join(a, b)
33#define wrapthread_mutex_init(a, b) pthread_mutex_init(a, b)
34#define wrapthread_mutex_lock(a) pthread_mutex_lock(a)
35#define wrapthread_mutex_unlock(a) pthread_mutex_unlock(a)
36
37#endif

Generated with cgit - Back to sebastiano.tronto.net