mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-21 03:50:16 +00:00
22 lines
512 B
C
22 lines
512 B
C
#include "pocketpy/export.h"
|
|
#include "pocketpy/common/threads.h"
|
|
|
|
#if PK_USE_PTHREADS
|
|
|
|
bool c11_thrd_create(c11_thrd_t* thrd, c11_thrd_retval_t (*func)(void*), void* arg) {
|
|
int res = pthread_create(thrd, NULL, func, arg);
|
|
return res == 0;
|
|
}
|
|
|
|
void c11_thrd_yield() { sched_yield(); }
|
|
|
|
#else
|
|
|
|
bool c11_thrd_create(c11_thrd_t* thrd, c11_thrd_retval_t (*func)(void*), void* arg) {
|
|
int res = thrd_create(thrd, func, arg);
|
|
return res == thrd_success;
|
|
}
|
|
|
|
void c11_thrd_yield() { thrd_yield(); }
|
|
|
|
#endif |