blob: b8f604dc210913c87877901392c13b84ac6f936d [file] [log] [blame]
Viet-Trung Luu96b05c12016-01-11 11:26:36 -08001#include "pthread_impl.h"
2#include <threads.h>
3
George Kulakowski17e3b042016-02-18 15:59:50 -08004int __pthread_create(pthread_t* restrict,
5 const pthread_attr_t* restrict,
6 void* (*)(void*),
7 void* restrict);
Viet-Trung Luu96b05c12016-01-11 11:26:36 -08008
George Kulakowski17e3b042016-02-18 15:59:50 -08009int thrd_create(thrd_t* thr, thrd_start_t func, void* arg) {
10 int ret =
11 __pthread_create(thr, __ATTRP_C11_THREAD, (void* (*)(void*))func, arg);
12 switch (ret) {
13 case 0:
14 return thrd_success;
15 case EAGAIN:
16 return thrd_nomem;
17 default:
18 return thrd_error;
19 }
Viet-Trung Luu96b05c12016-01-11 11:26:36 -080020}