wut  v1.5.0
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 OSThread;
20 
21 typedef struct OSMutex OSMutex;
22 typedef struct OSMutexLink OSMutexLink;
23 
25 {
28 };
29 WUT_CHECK_OFFSET(OSMutexLink, 0x00, next);
30 WUT_CHECK_OFFSET(OSMutexLink, 0x04, prev);
31 WUT_CHECK_SIZE(OSMutexLink, 0x8);
32 
33 #define OS_MUTEX_TAG 0x6D557458u
34 
35 struct OSMutex
36 {
38  uint32_t tag;
39 
41  const char *name;
42 
43  WUT_UNKNOWN_BYTES(4);
44 
47 
50 
52  int32_t count;
53 
56 };
57 WUT_CHECK_OFFSET(OSMutex, 0x00, tag);
58 WUT_CHECK_OFFSET(OSMutex, 0x04, name);
59 WUT_CHECK_OFFSET(OSMutex, 0x0c, queue);
60 WUT_CHECK_OFFSET(OSMutex, 0x1c, owner);
61 WUT_CHECK_OFFSET(OSMutex, 0x20, count);
62 WUT_CHECK_OFFSET(OSMutex, 0x24, link);
63 WUT_CHECK_SIZE(OSMutex, 0x2c);
64 
65 
69 void
71 
72 
76 void
78  const char *name);
79 
80 
93 void
95 
96 
110 BOOL
112 
113 
124 void
126 
127 
128 #ifdef __cplusplus
129 }
130 #endif
131 
uint32_t tag
Should always be set to the value OS_MUTEX_TAG.
Definition: mutex.h:38
int32_t count
Current recursion lock count of mutex.
Definition: mutex.h:52
OSThreadQueue queue
Queue of threads waiting for this mutex to unlock.
Definition: mutex.h:43
OSMutexLink link
Link used inside OSThread's mutex queue.
Definition: mutex.h:55
const char * name
Name set by OSInitMutexEx.
Definition: mutex.h:41
OSThread * owner
Current owner of mutex.
Definition: mutex.h:49
OSMutex * next
Definition: mutex.h:26
OSMutex * prev
Definition: mutex.h:27
void OSInitMutex(OSMutex *mutex)
Initialise a mutex structure.
BOOL OSTryLockMutex(OSMutex *mutex)
Try to lock a mutex.
void OSInitMutexEx(OSMutex *mutex, const char *name)
Initialise a mutex structure with a name.
void OSUnlockMutex(OSMutex *mutex)
Unlocks the mutex.
void OSLockMutex(OSMutex *mutex)
Lock the mutex.
Definition: mutex.h:36
int32_t BOOL
Definition: wut_types.h:7