Daniele Bartolini 12 лет назад
Родитель
Сommit
da517a2ddd
1 измененных файлов с 4 добавлено и 11 удалено
  1. 4 11
      engine/os/posix/Thread.h

+ 4 - 11
engine/os/posix/Thread.h

@@ -126,12 +126,10 @@ inline void Thread::stop()
 {
 	CE_ASSERT(m_is_running, "Thread is not running");
 	
-	m_is_running = false;
-
 	int32_t result = pthread_join(m_handle, NULL);
-
 	CE_ASSERT(result == 0, "Thread join failed. errno: %d", result);
 
+	m_is_running = false;
 	m_handle = 0;
 }
 
@@ -152,15 +150,10 @@ inline int32_t Thread::run()
 //-----------------------------------------------------------------------------
 inline void* Thread::thread_proc(void* arg)
 {
-	Thread* thread = (Thread*)arg;
-
-	int32_t result = thread->run();
-
-	CE_ASSERT(result == 0, "Function failed");
-
-	thread->m_is_running = false;
+	static int32_t result = -1;
+	result = ((Thread*)arg)->run();
 
-	return NULL;
+	return (void*)&result;
 }