Skip to content

Commit

Permalink
Fixes #1687 by extra semaphore retval handle code for OSX
Browse files Browse the repository at this point in the history
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 a0ac471
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/jthread/pthread/jsemaphore.cpp
Expand Up @@ -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
Expand Down

0 comments on commit a0ac471

Please sign in to comment.