diff options
author | David Robillard <d@drobilla.net> | 2022-09-01 23:14:03 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-09-01 23:59:38 -0400 |
commit | 7cd6a5437c263a4e2b64bafdf780d60ce51f941f (patch) | |
tree | a87d20b772ddc0e864cc2768a999af2d8f92cf13 /include | |
parent | 16a8597f4d52de948291825698b7d2458998a510 (diff) | |
download | zix-7cd6a5437c263a4e2b64bafdf780d60ce51f941f.tar.gz zix-7cd6a5437c263a4e2b64bafdf780d60ce51f941f.tar.bz2 zix-7cd6a5437c263a4e2b64bafdf780d60ce51f941f.zip |
Simplify thread and semaphore status codes
Diffstat (limited to 'include')
-rw-r--r-- | include/zix/common.h | 1 | ||||
-rw-r--r-- | include/zix/sem.h | 5 | ||||
-rw-r--r-- | include/zix/thread.h | 4 |
3 files changed, 6 insertions, 4 deletions
diff --git a/include/zix/common.h b/include/zix/common.h index 0cefd55..a097edd 100644 --- a/include/zix/common.h +++ b/include/zix/common.h @@ -29,6 +29,7 @@ typedef enum { ZIX_STATUS_TIMEOUT, ZIX_STATUS_OVERFLOW, ZIX_STATUS_NOT_SUPPORTED, + ZIX_STATUS_UNAVAILABLE, } ZixStatus; /// Return a string describing a status code diff --git a/include/zix/sem.h b/include/zix/sem.h index 4c82f17..41b9860 100644 --- a/include/zix/sem.h +++ b/include/zix/sem.h @@ -97,8 +97,9 @@ zix_sem_wait(ZixSem* ZIX_NONNULL sem); /** Non-blocking version of wait(). - @return #ZIX_STATUS_SUCCESS if `sem` was decremented, #ZIX_STATUS_TIMEOUT if - it was already zero, or #ZIX_STATUS_BAD_ARG if `sem` is invalid. + @return #ZIX_STATUS_SUCCESS if `sem` was decremented, + #ZIX_STATUS_UNAVAILABLE if it was already zero, or #ZIX_STATUS_BAD_ARG if + `sem` is invalid. */ ZIX_API ZixStatus diff --git a/include/zix/thread.h b/include/zix/thread.h index bad939f..482315a 100644 --- a/include/zix/thread.h +++ b/include/zix/thread.h @@ -103,9 +103,9 @@ zix_thread_create(ZixThread* thread, pthread_attr_setstacksize(&attr, stack_size); const int ret = pthread_create(thread, NULL, function, arg); - pthread_attr_destroy(&attr); - return ret == EAGAIN ? ZIX_STATUS_NO_MEM : zix_errno_status(ret); + pthread_attr_destroy(&attr); + return zix_errno_status(ret); } static inline ZixStatus |