Copyright © 2006 Mikko Rasa, Mikkosoft Productions
Distributed under the LGPL
*/
+
#ifndef WIN32
#include <sys/time.h>
#endif
init();
}
+void Semaphore::init()
+{
+#ifdef WIN32
+ count=0;
+ sem=CreateSemaphore(0, 0, 32, 0);
+#else
+ pthread_cond_init(&sem, 0);
+#endif
+}
+
+Semaphore::~Semaphore()
+{
+ if(own_mutex)
+ delete mutex;
+#ifdef WIN32
+ CloseHandle(sem);
+#else
+ pthread_cond_destroy(&sem);
+#endif
+}
+
#ifdef WIN32
int Semaphore::signal()
{
#endif
}
-Semaphore::~Semaphore()
-{
- if(own_mutex)
- delete mutex;
-#ifdef WIN32
- CloseHandle(sem);
-#else
- pthread_cond_destroy(&sem);
-#endif
-}
-
-void Semaphore::init()
-{
-#ifdef WIN32
- count=0;
- sem=CreateSemaphore(0, 0, 32, 0);
-#else
- pthread_cond_init(&sem, 0);
-#endif
-}
-
} // namespace Msp