4 #include <xbt/synchro.h>
8 mutex_t() { mutex = xbt_mutex_init(); }
9 ~mutex_t() { xbt_mutex_destroy(mutex); }
10 void acquire() { xbt_mutex_acquire(mutex); }
11 void release() { xbt_mutex_release(mutex); }
12 xbt_mutex_t get() { return mutex; }
20 condition_t() { cond = xbt_cond_init(); }
21 ~condition_t() { xbt_cond_destroy(cond); }
22 void broadcast() { xbt_cond_broadcast(cond); }
23 void signal() { xbt_cond_signal(cond); }
24 void wait(mutex_t& mutex) { xbt_cond_wait(cond, mutex.get()); }
25 void timedwait(mutex_t& mutex, double delay) {
26 xbt_cond_timedwait(cond, mutex.get(), delay);