Skip to content

Commit a0ac471

Browse files
neoasceticZeno-
authored andcommittedDec 14, 2014
Fixes #1687 by extra semaphore retval handle code for OSX
See #1687 (comment) Signed-off-by: Craig Robbins <kde.psych@gmail.com>
1 parent 06207ac commit a0ac471

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed
 

‎src/jthread/pthread/jsemaphore.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,13 @@ bool JSemaphore::Wait(unsigned int time_ms) {
115115
errno = 0;
116116
#ifdef __MACH__
117117
int sem_wait_retval = semaphore_timedwait(m_semaphore, waittime);
118+
if (sem_wait_retval == KERN_OPERATION_TIMED_OUT) {
119+
errno = ETIMEDOUT;
120+
} else if (sem_wait_retval == KERN_ABORTED) {
121+
errno = EINTR;
122+
} else if (sem_wait_retval != 0) {
123+
errno = EINVAL;
124+
}
118125
#else
119126
int sem_wait_retval = sem_timedwait(&m_semaphore, &waittime);
120127
#endif

0 commit comments

Comments
 (0)
Please sign in to comment.