2 #ifndef _3DS_SEMAPHORE_WRAP__
3 #define _3DS_SEMAPHORE_WRAP__
11 typedef uint32_t sem_t;
13 static inline int sem_init(sem_t *sem, int pshared, unsigned int value)
15 return svcCreateSemaphore(sem, value, INT32_MAX);
18 static inline int sem_post(sem_t *sem)
21 return svcReleaseSemaphore(&count, *sem, 1);
24 static inline int sem_wait(sem_t *sem)
26 return svcWaitSynchronization(*sem, INT64_MAX);
29 static inline int sem_destroy(sem_t *sem)
31 return svcCloseHandle(*sem);
34 #endif //_3DS_SEMAPHORE_WRAP__