summaryrefslogtreecommitdiffstats
path: root/include/zix/sem.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/zix/sem.h')
-rw-r--r--include/zix/sem.h9
1 files changed, 3 insertions, 6 deletions
diff --git a/include/zix/sem.h b/include/zix/sem.h
index 0337f03..3549e02 100644
--- a/include/zix/sem.h
+++ b/include/zix/sem.h
@@ -198,14 +198,11 @@ zix_sem_post(ZixSem* ZIX_NONNULL sem)
static inline ZixStatus
zix_sem_wait(ZixSem* ZIX_NONNULL sem)
{
- while (sem_wait(&sem->sem)) {
- if (errno != EINTR) {
- return ZIX_STATUS_ERROR;
- }
- /* Otherwise, interrupted, so try again. */
+ while (sem_wait(&sem->sem) && errno == EINTR) {
+ // Interrupted, try again
}
- return ZIX_STATUS_SUCCESS;
+ return zix_errno_status(errno);
}
static inline bool