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

Similar to Windows Semaphore Objects. More...

Collaboration diagram for Semaphore:

Data Structures

struct  OSSemaphore
 

Macros

#define OS_SEMAPHORE_TAG   0x73506852u
 

Typedefs

typedef struct OSSemaphore OSSemaphore
 

Functions

void OSInitSemaphore (OSSemaphore *semaphore, int32_t count)
 Initialise semaphore object with count. More...
 
void OSInitSemaphoreEx (OSSemaphore *semaphore, int32_t count, const char *name)
 Initialise semaphore object with count and name. More...
 
int32_t OSGetSemaphoreCount (OSSemaphore *semaphore)
 Get the current semaphore count. More...
 
int32_t OSSignalSemaphore (OSSemaphore *semaphore)
 Increase the semaphore value. More...
 
int32_t OSWaitSemaphore (OSSemaphore *semaphore)
 Decrease the semaphore value. More...
 
int32_t OSTryWaitSemaphore (OSSemaphore *semaphore)
 Try to decrease the semaphore value. More...
 

Detailed Description

Similar to Windows Semaphore Objects.


Data Structure Documentation

◆ OSSemaphore

struct OSSemaphore

Definition at line 21 of file semaphore.h.

Data Fields
uint32_t tag Should always be set to the value OS_SEMAPHORE_TAG.
const char * name Name set by OSInitMutexEx.
int32_t count Current count of semaphore.
OSThreadQueue queue Queue of threads waiting on semaphore object with OSWaitSemaphore.

Macro Definition Documentation

◆ OS_SEMAPHORE_TAG

#define OS_SEMAPHORE_TAG   0x73506852u

Definition at line 19 of file semaphore.h.

Typedef Documentation

◆ OSSemaphore

typedef struct OSSemaphore OSSemaphore

Definition at line 1 of file semaphore.h.

Function Documentation

◆ OSInitSemaphore()

void OSInitSemaphore ( OSSemaphore semaphore,
int32_t  count 
)

Initialise semaphore object with count.

◆ OSInitSemaphoreEx()

void OSInitSemaphoreEx ( OSSemaphore semaphore,
int32_t  count,
const char *  name 
)

Initialise semaphore object with count and name.

◆ OSGetSemaphoreCount()

int32_t OSGetSemaphoreCount ( OSSemaphore semaphore)

Get the current semaphore count.

◆ OSSignalSemaphore()

int32_t OSSignalSemaphore ( OSSemaphore semaphore)

Increase the semaphore value.

If any threads are waiting for semaphore, they are woken.

◆ OSWaitSemaphore()

int32_t OSWaitSemaphore ( OSSemaphore semaphore)

Decrease the semaphore value.

If the value is less than or equal to zero the current thread will be put to sleep until the count is above zero and it can decrement it safely.

◆ OSTryWaitSemaphore()

int32_t OSTryWaitSemaphore ( OSSemaphore semaphore)

Try to decrease the semaphore value.

If the value is greater than zero then it will be decremented, else the function will return immediately with a value <= 0 indicating a failure.

Returns
Returns previous semaphore count, before the decrement in this function. If the value is >0 then it means the call was succesful.