diff options
author | David Robillard <d@drobilla.net> | 2020-12-14 15:44:28 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-12-14 15:44:28 +0100 |
commit | 9226bfc74fa6580bbcec428e6291fb81cefe4e42 (patch) | |
tree | 7783a54207e94e95448a5a5278fb29c460aa3190 /src/zix/thread.h | |
parent | 3b6afde09317b4d79ffb8a65cb49d525fc7b4101 (diff) | |
download | jalv-9226bfc74fa6580bbcec428e6291fb81cefe4e42.tar.gz jalv-9226bfc74fa6580bbcec428e6291fb81cefe4e42.tar.bz2 jalv-9226bfc74fa6580bbcec428e6291fb81cefe4e42.zip |
Update zix
Diffstat (limited to 'src/zix/thread.h')
-rw-r--r-- | src/zix/thread.h | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/zix/thread.h b/src/zix/thread.h index 5802c99..3989f13 100644 --- a/src/zix/thread.h +++ b/src/zix/thread.h @@ -26,10 +26,10 @@ # include <pthread.h> #endif +#include <stddef.h> + #ifdef __cplusplus extern "C" { -#else -# include <stdbool.h> #endif /** @@ -80,6 +80,8 @@ zix_thread_create(ZixThread* thread, static inline ZixStatus zix_thread_join(ZixThread thread, void** retval) { + (void)retval; + return WaitForSingleObject(thread, INFINITE) ? ZIX_STATUS_SUCCESS : ZIX_STATUS_ERROR; } @@ -99,17 +101,13 @@ zix_thread_create(ZixThread* thread, const int ret = pthread_create(thread, NULL, function, arg); pthread_attr_destroy(&attr); - if (ret == EAGAIN) { - return ZIX_STATUS_NO_MEM; - } else if (ret == EINVAL) { - return ZIX_STATUS_BAD_ARG; - } else if (ret == EPERM) { - return ZIX_STATUS_BAD_PERMS; - } else if (ret) { - return ZIX_STATUS_ERROR; + switch (ret) { + case EAGAIN: return ZIX_STATUS_NO_MEM; + case EINVAL: return ZIX_STATUS_BAD_ARG; + case EPERM: return ZIX_STATUS_BAD_PERMS; } - return ZIX_STATUS_SUCCESS; + return ret ? ZIX_STATUS_ERROR : ZIX_STATUS_SUCCESS; } static inline ZixStatus |