Skip to content

Commit c3dc08f

Browse files
dgrove-ossdas
authored andcommitted
Bug fix in testing of return code of sem_timedwait
Code was not properly handling a return code of 0 from sem_timedwait (it would interpret it as a timeout). Change logic of test to match that used after the other call to sem_timedwait in this file. Signed-off-by: Daniel A. Steffen <[email protected]>
1 parent a8f140c commit c3dc08f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/semaphore.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ _dispatch_semaphore_wait_slow(dispatch_semaphore_t dsema,
348348
ret = slowpath(sem_timedwait(&dsema->dsema_sem, &_timeout));
349349
} while (ret == -1 && errno == EINTR);
350350

351-
if (ret == -1 && errno != ETIMEDOUT) {
351+
if (!(ret == -1 && errno == ETIMEDOUT)) {
352352
DISPATCH_SEMAPHORE_VERIFY_RET(ret);
353353
break;
354354
}

0 commit comments

Comments
 (0)