From e45c32c382120319a3403f9356c901b124f145e2 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 18 Aug 2022 16:57:29 -0400 Subject: Improve test coverage --- include/zix/sem.h | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'include/zix/sem.h') 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 -- cgit v1.2.1