Viet-Trung Luu | 96b05c1 | 2016-01-11 11:26:36 -0800 | [diff] [blame] | 1 | #include "pthread_impl.h" |
| 2 | #include <threads.h> |
| 3 | |
George Kulakowski | 17e3b04 | 2016-02-18 15:59:50 -0800 | [diff] [blame] | 4 | int __pthread_create(pthread_t* restrict, |
| 5 | const pthread_attr_t* restrict, |
| 6 | void* (*)(void*), |
| 7 | void* restrict); |
Viet-Trung Luu | 96b05c1 | 2016-01-11 11:26:36 -0800 | [diff] [blame] | 8 | |
George Kulakowski | 17e3b04 | 2016-02-18 15:59:50 -0800 | [diff] [blame] | 9 | int 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 Luu | 96b05c1 | 2016-01-11 11:26:36 -0800 | [diff] [blame] | 20 | } |