Fixes #1687 by extra semaphore retval handle code for OSX

See https://github.com/minetest/minetest/issues/1687#issuecomment-56830173

Signed-off-by: Craig Robbins <kde.psych@gmail.com>
master
Pavel Puchkin 2014-12-08 11:41:29 +02:00 committed by Craig Robbins
parent 06207ac550
commit a0ac471c1a
1 changed files with 7 additions and 0 deletions

View File

@ -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