X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Flib%2Fplatform%2Fposix%2Fos-threads.h;h=e5f935cf64ac9d24ff0c7637b53725755671c417;hb=f8edb2973d37f3ebfd08291f28be5435d0cf8f64;hp=fc28fc9017235fcb4804797dbf217cd2da8897c3;hpb=28b0f9fb414370ecd61b93722bfd7d129ea009a8;p=deb_libcec.git diff --git a/src/lib/platform/posix/os-threads.h b/src/lib/platform/posix/os-threads.h index fc28fc9..e5f935c 100644 --- a/src/lib/platform/posix/os-threads.h +++ b/src/lib/platform/posix/os-threads.h @@ -52,8 +52,8 @@ namespace PLATFORM #ifdef __APPLE__ struct timeval tv; gettimeofday(&tv, NULL); - now.tv_sec = tv.tv_sec + 0; - now.tv_nsec = 0; + now.tv_sec = tv.tv_sec; + now.tv_nsec = tv.tv_usec * 1000; #else clock_gettime(CLOCK_REALTIME, &now); #endif @@ -64,9 +64,10 @@ namespace PLATFORM } typedef pthread_t thread_t; + #define INVALID_THREAD_VALUE 0 #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());