diff options
-rw-r--r-- | src/jthread/pthread/jsemaphore.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/jthread/pthread/jsemaphore.cpp b/src/jthread/pthread/jsemaphore.cpp index 609e2f518..16e001e92 100644 --- a/src/jthread/pthread/jsemaphore.cpp +++ b/src/jthread/pthread/jsemaphore.cpp @@ -115,6 +115,13 @@ bool JSemaphore::Wait(unsigned int time_ms) { errno = 0; #ifdef __MACH__ int sem_wait_retval = semaphore_timedwait(m_semaphore, waittime); + if (sem_wait_retval == KERN_OPERATION_TIMED_OUT) { + errno = ETIMEDOUT; + } else if (sem_wait_retval == KERN_ABORTED) { + errno = EINTR; + } else if (sem_wait_retval != 0) { + errno = EINVAL; + } #else int sem_wait_retval = sem_timedwait(&m_semaphore, &waittime); #endif |