summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2022-08-19 14:05:26 -0400
committerDavid Robillard <d@drobilla.net>2022-08-19 14:21:32 -0400
commit171aa2a60a8deeaf7b7692a0ecb6de56df1607f8 (patch)
tree9656d3faa9f982c688188911b658962bf8d618c0 /include
parent1069c63c6ca2713cce2d6153acc1a1ef9f2b7f8f (diff)
downloadzix-171aa2a60a8deeaf7b7692a0ecb6de56df1607f8.tar.gz
zix-171aa2a60a8deeaf7b7692a0ecb6de56df1607f8.tar.bz2
zix-171aa2a60a8deeaf7b7692a0ecb6de56df1607f8.zip
Simplify errno handling
Diffstat (limited to 'include')
-rw-r--r--include/zix/thread.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/include/zix/thread.h b/include/zix/thread.h
index 9c213de..bad939f 100644
--- a/include/zix/thread.h
+++ b/include/zix/thread.h
@@ -12,6 +12,7 @@
# include <pthread.h>
#endif
+#include <errno.h>
#include <stddef.h>
#ifdef __cplusplus
@@ -92,10 +93,10 @@ zix_thread_join(ZixThread thread)
#else /* !defined(_WIN32) */
static inline ZixStatus
-zix_thread_create(ZixThread* thread,
- size_t stack_size,
- void* (*function)(void*),
- void* arg)
+zix_thread_create(ZixThread* thread,
+ size_t stack_size,
+ ZixThreadFunc function,
+ void* arg)
{
pthread_attr_t attr;
pthread_attr_init(&attr);
@@ -104,7 +105,7 @@ zix_thread_create(ZixThread* thread,
const int ret = pthread_create(thread, NULL, function, arg);
pthread_attr_destroy(&attr);
- return zix_errno_status(ret);
+ return ret == EAGAIN ? ZIX_STATUS_NO_MEM : zix_errno_status(ret);
}
static inline ZixStatus