2 #include "lang/verify.h"
5 VERIFY(pthread_mutex_init(&m, NULL) == 0);
9 VERIFY(pthread_mutex_destroy(&m) == 0);
12 void mutex::acquire() {
13 VERIFY(pthread_mutex_lock(&m) == 0);
16 void mutex::release() {
17 VERIFY(pthread_mutex_unlock(&m) == 0);
20 mutex::operator pthread_mutex_t *() {
25 VERIFY(pthread_cond_init(&c, NULL) == 0);
29 VERIFY(pthread_cond_destroy(&c) == 0);
32 void cond::wait(mutex &m) {
33 VERIFY(pthread_cond_wait(&c, m) == 0);
37 VERIFY(pthread_cond_signal(&c) == 0);
40 void cond::broadcast() {
41 VERIFY(pthread_cond_broadcast(&c) == 0);