Browse Source

Fix up posix threading backend

Bart van Strien 14 years ago
parent
commit
8c5db2a92f

+ 3 - 3
src/modules/thread/posix/threads.cpp

@@ -26,7 +26,7 @@ namespace thread
 {
 	Mutex::Mutex()
 	{
-		pthread_create_mutex(&mutex, NULL);
+		pthread_mutex_init(&mutex, NULL);
 	}
 
 	Mutex::~Mutex()
@@ -157,7 +157,7 @@ namespace thread
 	bool Conditional::wait(Mutex* mutex, int timeout)
 	{
 		if (timeout < 0)
-			return !pthread_cond_wait(cond, mutex->mutex);
+			return !pthread_cond_wait(&cond, &mutex->mutex);
 		else
 		{
 			struct timespec ts;
@@ -166,7 +166,7 @@ namespace thread
 			ts.tv_sec = timeout / 1000;
 			ts.tv_nsec = (timeout % 1000) * 1000000;
 
-			ret = pthread_cond_timedwait(&cond, mutex->mutex, &ts);
+			ret = pthread_cond_timedwait(&cond, &mutex->mutex, &ts);
 			return (ret == 0);
 		}
 	}

+ 3 - 1
src/modules/thread/posix/threads.h

@@ -23,6 +23,7 @@
 
 #include <pthread.h>
 #include <semaphore.h>
+#include <signal.h>
 
 namespace love
 {
@@ -52,6 +53,7 @@ namespace thread
 		ThreadBase(ThreadBase& thread) {}
 
 		static void* thread_runner(void* param);
+		bool running;
 
 	protected:
 
@@ -72,7 +74,7 @@ namespace thread
 	{
 	private:
 		Semaphore(const Semaphore& sem) {}
-		sem_t semaphore;
+		sem_t sem;
 
 	public:
 		Semaphore(unsigned int initial_value);

+ 2 - 0
src/modules/thread/threads.h

@@ -21,6 +21,8 @@
 #ifndef LOVE_THREAD_THREADS_H
 #define LOVE_THREAD_THREADS_H
 
+#include <common/config.h>
+
 #define LOVE_THREADS_SDL	0
 #define LOVE_THREADS_WIN32	1
 #define LOVE_THREADS_POSIX	2