posix: don't segfault when calling ThreadsWait() without a valid thread
authorLars Op den Kamp <lars@opdenkamp.eu>
Mon, 23 Apr 2012 09:18:34 +0000 (11:18 +0200)
committerLars Op den Kamp <lars@opdenkamp.eu>
Mon, 23 Apr 2012 12:06:31 +0000 (14:06 +0200)
src/lib/platform/posix/os-threads.h

index 8b56731adfa2918f2a290e71dd4acc62ce2b7709..89f822b0dec300a89aee85d2f55e62871fac9080 100644 (file)
@@ -66,7 +66,7 @@ namespace PLATFORM
   typedef pthread_t thread_t;
 
   #define ThreadsCreate(thread, func, arg)         (pthread_create(&thread, NULL, (void *(*) (void *))func, (void *)arg) == 0)
-  #define ThreadsWait(thread, retval)              (pthread_join(thread, retval) == 0)
+  #define ThreadsWait(thread, retval)              (thread ? pthread_join(thread, retval) == 0 : true)
 
   typedef pthread_mutex_t mutex_t;
   #define MutexCreate(mutex)                       pthread_mutex_init(&mutex, GetRecursiveMutexAttribute());