summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/zix/common.h5
-rw-r--r--include/zix/thread.h12
2 files changed, 6 insertions, 11 deletions
diff --git a/include/zix/common.h b/include/zix/common.h
index 5919fa9..c0944b5 100644
--- a/include/zix/common.h
+++ b/include/zix/common.h
@@ -33,6 +33,11 @@ ZIX_CONST_API
const char*
zix_strerror(ZixStatus status);
+/// Return an errno value converted to a status code
+ZIX_CONST_API
+ZixStatus
+zix_errno_status(int e);
+
/// Function for comparing two elements
typedef int (*ZixComparator)(const void* a,
const void* b,
diff --git a/include/zix/thread.h b/include/zix/thread.h
index 74bb19b..c80add0 100644
--- a/include/zix/thread.h
+++ b/include/zix/thread.h
@@ -9,7 +9,6 @@
#ifdef _WIN32
# include <windows.h>
#else
-# include <errno.h>
# include <pthread.h>
#endif
@@ -85,16 +84,7 @@ zix_thread_create(ZixThread* thread,
const int ret = pthread_create(thread, NULL, function, arg);
pthread_attr_destroy(&attr);
- switch (ret) {
- case EAGAIN:
- return ZIX_STATUS_NO_MEM;
- case EINVAL:
- return ZIX_STATUS_BAD_ARG;
- case EPERM:
- return ZIX_STATUS_BAD_PERMS;
- }
-
- return ret ? ZIX_STATUS_ERROR : ZIX_STATUS_SUCCESS;
+ return zix_errno_status(ret);
}
static inline ZixStatus