wut v1.8.0
Wii U Toolchain
Loading...
Searching...
No Matches
semaphore.h
Go to the documentation of this file.
1#pragma once
2#include <wut.h>
3#include "threadqueue.h"
4
13#ifdef __cplusplus
14extern "C" {
15#endif
16
17typedef struct OSSemaphore OSSemaphore;
18
19#define OS_SEMAPHORE_TAG 0x73506852u
20
22{
24 uint32_t tag;
25
27 const char *name;
28
29 WUT_UNKNOWN_BYTES(4);
30
32 int32_t count;
33
36};
37WUT_CHECK_OFFSET(OSSemaphore, 0x00, tag);
38WUT_CHECK_OFFSET(OSSemaphore, 0x04, name);
39WUT_CHECK_OFFSET(OSSemaphore, 0x0C, count);
40WUT_CHECK_OFFSET(OSSemaphore, 0x10, queue);
41WUT_CHECK_SIZE(OSSemaphore, 0x20);
42
43
47void
49 int32_t count);
50
51
55void
57 int32_t count,
58 const char *name);
59
60
64int32_t
66
67
73int32_t
75
76
83int32_t
85
86
96int32_t
98
99
100#ifdef __cplusplus
101}
102#endif
103
uint32_t tag
Should always be set to the value OS_SEMAPHORE_TAG.
Definition semaphore.h:24
int32_t count
Current count of semaphore.
Definition semaphore.h:32
OSThreadQueue queue
Queue of threads waiting on semaphore object with OSWaitSemaphore.
Definition semaphore.h:35
const char * name
Name set by OSInitMutexEx.
Definition semaphore.h:27
int32_t OSWaitSemaphore(OSSemaphore *semaphore)
Decrease the semaphore value.
int32_t OSTryWaitSemaphore(OSSemaphore *semaphore)
Try to decrease the semaphore value.
int32_t OSSignalSemaphore(OSSemaphore *semaphore)
Increase the semaphore value.
int32_t OSGetSemaphoreCount(OSSemaphore *semaphore)
Get the current semaphore count.
void OSInitSemaphoreEx(OSSemaphore *semaphore, int32_t count, const char *name)
Initialise semaphore object with count and name.
void OSInitSemaphore(OSSemaphore *semaphore, int32_t count)
Initialise semaphore object with count.