Skip to content
Permalink
Browse files

Fixes #1687 by extra semaphore retval handle code for OSX

See #1687 (comment)

Signed-off-by: Craig Robbins <kde.psych@gmail.com>
  • Loading branch information
neoascetic authored and Zeno- committed Dec 14, 2014
1 parent 06207ac commit a0ac471c1af4d0a6df12021d51dcbfe4ced267aa
Showing with 7 additions and 0 deletions.
  1. +7 −0 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

0 comments on commit a0ac471

Please sign in to comment.