From a0ac471c1af4d0a6df12021d51dcbfe4ced267aa Mon Sep 17 00:00:00 2001 From: Pavel Puchkin Date: Mon, 8 Dec 2014 11:41:29 +0200 Subject: 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 --- src/jthread/pthread/jsemaphore.cpp | 7 +++++++ 1 file changed, 7 insertions(+) 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 -- cgit v1.2.3