wut  v1.5.0
Wii U Toolchain
semaphore.h
Go to the documentation of this file.
1 #pragma once
2 #include <wut.h>
3 #include "threadqueue.h"
4 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
17 typedef 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 };
37 WUT_CHECK_OFFSET(OSSemaphore, 0x00, tag);
38 WUT_CHECK_OFFSET(OSSemaphore, 0x04, name);
39 WUT_CHECK_OFFSET(OSSemaphore, 0x0C, count);
40 WUT_CHECK_OFFSET(OSSemaphore, 0x10, queue);
41 WUT_CHECK_SIZE(OSSemaphore, 0x20);
42 
43 
47 void
49  int32_t count);
50 
51 
55 void
57  int32_t count,
58  const char *name);
59 
60 
64 int32_t
66 
67 
73 int32_t
75 
76 
83 int32_t
85 
86 
96 int32_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:29
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.