cdrom: fail pausing on seek
[pcsx_rearmed.git] / frontend / 3ds / semaphore.h
CommitLineData
c81b3e15
JW
1
2#ifndef _3DS_SEMAPHORE_WRAP__
3#define _3DS_SEMAPHORE_WRAP__
4
5#include <stdlib.h>
6#include <string.h>
7#include <stdio.h>
8
9#include "3ds_utils.h"
10
11typedef uint32_t sem_t;
12
13static inline int sem_init(sem_t *sem, int pshared, unsigned int value)
14{
15 return svcCreateSemaphore(sem, value, INT32_MAX);
16}
17
18static inline int sem_post(sem_t *sem)
19{
20 int32_t count;
21 return svcReleaseSemaphore(&count, *sem, 1);
22}
23
24static inline int sem_wait(sem_t *sem)
25{
26 return svcWaitSynchronization(*sem, INT64_MAX);
27}
28
29static inline int sem_destroy(sem_t *sem)
30{
31 return svcCloseHandle(*sem);
32}
33
34#endif //_3DS_SEMAPHORE_WRAP__
35