WUT  0.1
Wii U Toolchain
mutex.h
Go to the documentation of this file.
1 #pragma once
2 #include <wut.h>
3 #include "threadqueue.h"
4 
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18 
19 typedef struct OSThread;
20 
21 typedef struct OSCondition OSCondition;
22 typedef struct OSMutex OSMutex;
23 typedef struct OSMutexLink OSMutexLink;
24 
26 {
29 };
30 CHECK_OFFSET(OSMutexLink, 0x00, next);
31 CHECK_OFFSET(OSMutexLink, 0x04, prev);
32 CHECK_SIZE(OSMutexLink, 0x8);
33 
34 #define OS_MUTEX_TAG 0x6D557458u
35 
36 struct OSMutex
37 {
39  uint32_t tag;
40 
42  const char *name;
43 
44  UNKNOWN(4);
45 
48 
51 
53  int32_t count;
54 
57 };
58 CHECK_OFFSET(OSMutex, 0x00, tag);
59 CHECK_OFFSET(OSMutex, 0x04, name);
60 CHECK_OFFSET(OSMutex, 0x0c, queue);
61 CHECK_OFFSET(OSMutex, 0x1c, owner);
62 CHECK_OFFSET(OSMutex, 0x20, count);
63 CHECK_OFFSET(OSMutex, 0x24, link);
64 CHECK_SIZE(OSMutex, 0x2c);
65 
66 
70 void
71 OSInitMutex(OSMutex *mutex);
72 
73 
77 void
78 OSInitMutexEx(OSMutex *mutex,
79  const char *name);
80 
81 
94 void
95 OSLockMutex(OSMutex *mutex);
96 
97 
111 BOOL
112 OSTryLockMutex(OSMutex *mutex);
113 
114 
125 void
126 OSUnlockMutex(OSMutex *mutex);
127 
128 
129 #ifdef __cplusplus
130 }
131 #endif
132 
int32_t count
Current recursion lock count of mutex.
Definition: mutex.h:53
OSThreadQueue queue
Queue of threads waiting for this mutex to unlock.
Definition: mutex.h:47
void OSInitMutexEx(OSMutex *mutex, const char *name)
uint32_t tag
Should always be set to the value OS_MUTEX_TAG.
Definition: mutex.h:39
void OSUnlockMutex(OSMutex *mutex)
int BOOL
Definition: wut_types.h:4
OSThread * owner
Current owner of mutex.
Definition: mutex.h:50
Definition: mutex.h:36
void OSLockMutex(OSMutex *mutex)
void OSInitMutex(OSMutex *mutex)
BOOL OSTryLockMutex(OSMutex *mutex)
const char * name
Name set by OSInitMutexEx.
Definition: mutex.h:42
OSMutexLink link
Link used inside OSThread's mutex queue.
Definition: mutex.h:56