aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPavel Puchkin <i@neoascetic.me>2014-12-08 11:41:29 +0200
committerCraig Robbins <kde.psych@gmail.com>2014-12-15 02:12:39 +1000
commita0ac471c1af4d0a6df12021d51dcbfe4ced267aa (patch)
tree5ac7ec25a5a5ae1c733c07f4669ac92ce69c8d0f /src
parent06207ac5508aff63573c91e758073ba1c8960a41 (diff)
downloadminetest-a0ac471c1af4d0a6df12021d51dcbfe4ced267aa.tar.gz
minetest-a0ac471c1af4d0a6df12021d51dcbfe4ced267aa.tar.bz2
minetest-a0ac471c1af4d0a6df12021d51dcbfe4ced267aa.zip
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>
Diffstat (limited to 'src')
-rw-r--r--src/jthread/pthread/jsemaphore.cpp7
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