2 #ifndef _3DS_PTHREAD_WRAP__
3 #define _3DS_PTHREAD_WRAP__
11 #define CTR_PTHREAD_STACK_SIZE 0x10000
18 typedef int pthread_attr_t;
20 static inline int pthread_create(pthread_t *thread,
21 const pthread_attr_t *attr, void *(*start_routine)(void*), void *arg)
24 thread->stack = linearMemAlign(CTR_PTHREAD_STACK_SIZE, 8);
26 svcCreateThread(&thread->handle, start_routine, arg,
27 (uint32_t*)((uint32_t)thread->stack + CTR_PTHREAD_STACK_SIZE),
34 static inline int pthread_join(pthread_t thread, void **retval)
38 if(svcWaitSynchronization(thread.handle, INT64_MAX))
41 linearFree(thread.stack);
47 static inline void pthread_exit(void *retval)
55 #endif //_3DS_PTHREAD_WRAP__