wut  v1.7.0
Wii U Toolchain
Data Structures | Macros | Typedefs | Functions

Standard mutex object, supports recursive locking. More...

Collaboration diagram for Mutex:

Data Structures

struct  OSMutex
 

Macros

#define OS_MUTEX_TAG   0x6D557458u
 

Typedefs

typedef struct OSThread OSThread
 
typedef struct OSMutex OSMutex
 
typedef struct OSMutexLink OSMutexLink
 

Functions

void OSInitMutex (OSMutex *mutex)
 Initialise a mutex structure. More...
 
void OSInitMutexEx (OSMutex *mutex, const char *name)
 Initialise a mutex structure with a name. More...
 
void OSLockMutex (OSMutex *mutex)
 Lock the mutex. More...
 
BOOL OSTryLockMutex (OSMutex *mutex)
 Try to lock a mutex. More...
 
void OSUnlockMutex (OSMutex *mutex)
 Unlocks the mutex. More...
 

Detailed Description

Standard mutex object, supports recursive locking.

Similar to std::recursive_mutex.


Data Structure Documentation

◆ OSMutexLink

struct OSMutexLink

Definition at line 24 of file mutex.h.

Data Fields
OSMutex * next
OSMutex * prev

◆ OSMutex

struct OSMutex

Definition at line 35 of file mutex.h.

Data Fields
uint32_t tag Should always be set to the value OS_MUTEX_TAG.
const char * name Name set by OSInitMutexEx.
OSThreadQueue queue Queue of threads waiting for this mutex to unlock.
OSThread * owner Current owner of mutex.
int32_t count Current recursion lock count of mutex.
OSMutexLink link Link used inside OSThread's mutex queue.

Macro Definition Documentation

◆ OS_MUTEX_TAG

#define OS_MUTEX_TAG   0x6D557458u

Definition at line 33 of file mutex.h.

Typedef Documentation

◆ OSThread

typedef struct OSThread OSThread

Definition at line 1 of file mutex.h.

◆ OSMutex

typedef struct OSMutex OSMutex

Definition at line 1 of file mutex.h.

◆ OSMutexLink

typedef struct OSMutexLink OSMutexLink

Definition at line 1 of file mutex.h.

Function Documentation

◆ OSInitMutex()

void OSInitMutex ( OSMutex mutex)

Initialise a mutex structure.

◆ OSInitMutexEx()

void OSInitMutexEx ( OSMutex mutex,
const char *  name 
)

Initialise a mutex structure with a name.

◆ OSLockMutex()

void OSLockMutex ( OSMutex mutex)

Lock the mutex.

If no one owns the mutex, set current thread as owner.

If the lock is owned by the current thread, increase the recursion count.

If the lock is owned by another thread, the current thread will sleep until the owner has unlocked this mutex.

Similar to std::recursive_mutex::lock.

◆ OSTryLockMutex()

BOOL OSTryLockMutex ( OSMutex mutex)

Try to lock a mutex.

If no one owns the mutex, set current thread as owner.

If the lock is owned by the current thread, increase the recursion count.

If the lock is owned by another thread, do not block, return FALSE.

Returns
TRUE if the mutex is locked, FALSE if the mutex is owned by another thread.

Similar to std::recursive_mutex::try_lock.

◆ OSUnlockMutex()

void OSUnlockMutex ( OSMutex mutex)

Unlocks the mutex.

Will decrease the recursion count, will only unlock the mutex when the recursion count reaches 0.

If any other threads are waiting to lock the mutex they will be woken.

Similar to std::recursive_mutex::unlock.