From 171aa2a60a8deeaf7b7692a0ecb6de56df1607f8 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 19 Aug 2022 14:05:26 -0400 Subject: Simplify errno handling --- include/zix/thread.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'include/zix/thread.h') 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 #endif +#include #include #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 -- cgit v1.2.1