]> git.tdb.fi Git - libs/core.git/blobdiff - source/core/semaphore.cpp
Make sure all files have the correct header
[libs/core.git] / source / core / semaphore.cpp
index bba39642c8c6aee8c52da11e931555a13645d485..bd1180b805b2701231e7833414717ea8bd7a9802 100644 (file)
@@ -4,6 +4,7 @@ This file is part of libmspcore
 Copyright © 2006  Mikko Rasa, Mikkosoft Productions
 Distributed under the LGPL
 */
+
 #ifndef WIN32
 #include <sys/time.h>
 #endif
@@ -29,6 +30,27 @@ Semaphore::Semaphore(Mutex &m):
        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()
 {
@@ -97,25 +119,4 @@ int Semaphore::wait(const Time::TimeDelta &d)
 #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