3 This file is part of libmspcore
4 Copyright © 2006 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
7 #ifndef MSP_CORE_SEMAPHORE_H_
8 #define MSP_CORE_SEMAPHORE_H_
12 #include "../time/timedelta.h"
24 int wait(const Time::TimeDelta &);
25 Mutex &get_mutex() { return *mutex; }
39 inline int Semaphore::signal()
40 { return pthread_cond_signal(&sem); }
42 inline int Semaphore::broadcast()
43 { return pthread_cond_broadcast(&sem); }
45 inline int Semaphore::wait()
46 { return pthread_cond_wait(&sem, &mutex->mutex); }