From: Lars Op den Kamp Date: Mon, 23 Apr 2012 09:18:34 +0000 (+0200) Subject: posix: don't segfault when calling ThreadsWait() without a valid thread X-Git-Tag: upstream/2.2.0~1^2~29^2^2~69 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=3a99ce7f6d43f2bb1b35d7365d1ca476cd967626;p=deb_libcec.git posix: don't segfault when calling ThreadsWait() without a valid thread --- diff --git a/src/lib/platform/posix/os-threads.h b/src/lib/platform/posix/os-threads.h index 8b56731..89f822b 100644 --- a/src/lib/platform/posix/os-threads.h +++ b/src/lib/platform/posix/os-threads.h @@ -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());