diff options
author | Twinaphex | 2019-10-07 18:09:17 +0200 |
---|---|---|
committer | GitHub | 2019-10-07 18:09:17 +0200 |
commit | eb6943ee04b0f30a6f1cebfe399a94bacd1dfb45 (patch) | |
tree | e7f11673ffaaa21b0cbd2fad2e5e3b367982a03b /frontend/3ds/pthread.h | |
parent | d5c8842cedcf268d34ffe0be6abe4f8545cf2c5f (diff) | |
parent | 93c24a5631ba5281046d2cd1b141cc2f0ce1d29f (diff) | |
download | pcsx_rearmed-eb6943ee04b0f30a6f1cebfe399a94bacd1dfb45.tar.gz pcsx_rearmed-eb6943ee04b0f30a6f1cebfe399a94bacd1dfb45.tar.bz2 pcsx_rearmed-eb6943ee04b0f30a6f1cebfe399a94bacd1dfb45.zip |
Merge pull request #354 from justinweiss/move-to-thread-api
3DS: Switch from svc* to the thread* API
Diffstat (limited to 'frontend/3ds/pthread.h')
-rw-r--r-- | frontend/3ds/pthread.h | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/frontend/3ds/pthread.h b/frontend/3ds/pthread.h index 42de161..9f43707 100644 --- a/frontend/3ds/pthread.h +++ b/frontend/3ds/pthread.h @@ -10,23 +10,13 @@ #define CTR_PTHREAD_STACK_SIZE 0x10000 -typedef struct -{ - int32_t handle; - uint32_t* stack; -}pthread_t; +typedef int32_t pthread_t; typedef int pthread_attr_t; static inline int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void*), void *arg) { - - thread->stack = linearMemAlign(CTR_PTHREAD_STACK_SIZE, 8); - - svcCreateThread(&thread->handle, start_routine, arg, - (uint32_t*)((uint32_t)thread->stack + CTR_PTHREAD_STACK_SIZE), - 0x25, -2); - + thread = threadCreate(start_routine, arg, CTR_PTHREAD_STACK_SIZE, 0x25, -2, FALSE); return 1; } @@ -35,10 +25,10 @@ static inline int pthread_join(pthread_t thread, void **retval) { (void)retval; - if(svcWaitSynchronization(thread.handle, INT64_MAX)) + if(threadJoin(thread, INT64_MAX)) return -1; - linearFree(thread.stack); + threadFree(thread); return 0; } @@ -48,7 +38,7 @@ static inline void pthread_exit(void *retval) { (void)retval; - svcExitThread(); + threadExit(0); } |