diff options
Diffstat (limited to 'src/thread/thrd_create.c')
-rw-r--r-- | src/thread/thrd_create.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/thread/thrd_create.c b/src/thread/thrd_create.c new file mode 100644 index 00000000..e0336695 --- /dev/null +++ b/src/thread/thrd_create.c @@ -0,0 +1,14 @@ +#include "pthread_impl.h" +#include <threads.h> + +int __pthread_create(pthread_t *restrict, const pthread_attr_t *restrict, void *(*)(void *), void *restrict); + +int thrd_create(thrd_t *thr, thrd_start_t func, void *arg) +{ + int ret = __pthread_create(thr, __ATTRP_C11_THREAD, (void *(*)(void *))func, arg); + switch (ret) { + case 0: return thrd_success; + case EAGAIN: return thrd_nomem; + default: return thrd_error; + } +} |