X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fcore%2Fsemaphore.h;h=1cf3cd6ad11b44402eacca11d415d9df60941916;hp=164131acaaa8c19d5f94b9139be12fe9e05117a6;hb=fe77fc6b869a71bf94d501a0762579f4ddbc5094;hpb=c6e82eb96aba6354a35143ccae6f0ae87b4c1204 diff --git a/source/core/semaphore.h b/source/core/semaphore.h index 164131a..1cf3cd6 100644 --- a/source/core/semaphore.h +++ b/source/core/semaphore.h @@ -1,5 +1,5 @@ /* -This file is part of libmspframework +This file is part of libmspcore Copyright © 2006 Mikko Rasa, Mikkosoft Productions Distributed under the LGPL */ @@ -17,10 +17,9 @@ class Semaphore public: #ifndef WIN32 Semaphore() { pthread_cond_init(&sem, 0); } - //Mutex &get_mutex() { return mutex; } int signal() { MutexLock l(mutex); return pthread_cond_signal(&sem); } int broadcast() { MutexLock l(mutex); return pthread_cond_broadcast(&sem); } - int wait() { mutex.lock(); return pthread_cond_wait(&sem, &mutex.mutex); } + int wait() { MutexLock l(mutex); return pthread_cond_wait(&sem, &mutex.mutex); } int wait(const Time::TimeDelta &); ~Semaphore() { pthread_cond_destroy(&sem); } #else @@ -32,7 +31,9 @@ public: ~Semaphore() { CloseHandle(sem); } #endif private: +#ifndef WIN32 Mutex mutex; +#endif SemaphoreHandle sem; };