summaryrefslogtreecommitdiffstats
path: root/zix/thread.h
diff options
context:
space:
mode:
Diffstat (limited to 'zix/thread.h')
-rw-r--r--zix/thread.h14
1 files changed, 5 insertions, 9 deletions
diff --git a/zix/thread.h b/zix/thread.h
index 2af0c5e..e2b59c4 100644
--- a/zix/thread.h
+++ b/zix/thread.h
@@ -101,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