nissy-core

The "engine" of nissy, including the H48 optimal solver.
git clone https://git.tronto.net/nissy-core
Download | Log | Files | Refs | README | LICENSE

wrapthread.h (1139B)


      1 #if THREADS == 1
      2 
      3 #define wrapthread_atomic
      4 
      5 #define wrapthread_define_var_thread_t(x) unused char x
      6 #define wrapthread_define_var_mutex_t(x) unused char 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