2 This file is part of libmspframework
3 Copyright © 2006 Mikko Rasa, Mikkosoft Productions
4 Distributed under the LGPL
6 #ifndef MSP_FRAMEWORK_SEMAPHORE_H_
7 #define MSP_FRAMEWORK_SEMAPHORE_H_
17 Semaphore() { pthread_cond_init(&cond, 0); }
18 Mutex &get_mutex() { return mutex; }
19 int signal() { return pthread_cond_signal(&cond); }
20 int broadcast() { return pthread_cond_broadcast(&cond); }
21 int wait() { return pthread_cond_wait(&cond, &mutex.mutex); }
22 ~Semaphore() { pthread_cond_destroy(&cond); }