diff --git a/VERSION b/VERSION index 4e21192a..f317be1d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -B2-rc3-13-g76e119f8ad+1 \ No newline at end of file +B2-rc3-21-g380b5df9f9+1 \ No newline at end of file diff --git a/common/src/platform/linux/event.c b/common/src/platform/linux/event.c index 4495bf4a..a54c2bfc 100644 --- a/common/src/platform/linux/event.c +++ b/common/src/platform/linux/event.c @@ -83,19 +83,20 @@ bool lgWaitEventAbs(LGEvent * handle, struct timespec * ts) } bool ret = true; + int res; while(ret && !atomic_load(&handle->flag)) { if (!ts) { - if (pthread_cond_wait(&handle->cond, &handle->mutex) != 0) + if ((res = pthread_cond_wait(&handle->cond, &handle->mutex)) != 0) { - DEBUG_ERROR("Wait to wait on the condition"); + DEBUG_ERROR("Failed to wait on the condition (err: %d)", res); ret = false; } } else { - switch(pthread_cond_timedwait(&handle->cond, &handle->mutex, ts)) + switch((res = pthread_cond_timedwait(&handle->cond, &handle->mutex, ts))) { case 0: break; @@ -106,7 +107,7 @@ bool lgWaitEventAbs(LGEvent * handle, struct timespec * ts) default: ret = false; - DEBUG_ERROR("Timed wait failed"); + DEBUG_ERROR("Timed wait failed (err: %d)", res); break; } } @@ -145,6 +146,9 @@ bool lgWaitEventNS(LGEvent * handle, unsigned int timeout) bool lgWaitEvent(LGEvent * handle, unsigned int timeout) { + if (timeout == TIMEOUT_INFINITE) + return lgWaitEventAbs(handle, NULL); + return lgWaitEventNS(handle, timeout * 1000000); }