wut v1.8.0
Wii U Toolchain
Loading...
Searching...
No Matches
mutex.h
Go to the documentation of this file.
1#pragma once
2#include <wut.h>
3#include "threadqueue.h"
4
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19typedef struct OSThread OSThread;
20
21typedef struct OSMutex OSMutex;
22typedef struct OSMutexLink OSMutexLink;
23
29WUT_CHECK_OFFSET(OSMutexLink, 0x00, next);
30WUT_CHECK_OFFSET(OSMutexLink, 0x04, prev);
31WUT_CHECK_SIZE(OSMutexLink, 0x8);
32
33#define OS_MUTEX_TAG 0x6D557458u
34
35struct 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};
57WUT_CHECK_OFFSET(OSMutex, 0x00, tag);
58WUT_CHECK_OFFSET(OSMutex, 0x04, name);
59WUT_CHECK_OFFSET(OSMutex, 0x0c, queue);
60WUT_CHECK_OFFSET(OSMutex, 0x1c, owner);
61WUT_CHECK_OFFSET(OSMutex, 0x20, count);
62WUT_CHECK_OFFSET(OSMutex, 0x24, link);
63WUT_CHECK_SIZE(OSMutex, 0x2c);
64
65
69void
71
72
76void
78 const char *name);
79
80
93void
95
96
110BOOL
112
113
124void
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:46
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.
int32_t BOOL
Definition wut_types.h:7