WUT  0.1
Wii U Toolchain
Data Structures | Macros | Typedefs | Functions
Semaphore

Data Structures

struct  OSSemaphore
 

Macros

#define OS_SEMAPHORE_TAG   0x73506852u
 

Typedefs

typedef struct OSSemaphore OSSemaphore
 

Functions

void OSInitSemaphore (OSSemaphore *semaphore, int32_t count)
 
void OSInitSemaphoreEx (OSSemaphore *semaphore, int32_t count, const char *name)
 
int32_t OSGetSemaphoreCount (OSSemaphore *semaphore)
 
int32_t OSSignalSemaphore (OSSemaphore *semaphore)
 
int32_t OSWaitSemaphore (OSSemaphore *semaphore)
 
int32_t OSTryWaitSemaphore (OSSemaphore *semaphore)
 

Detailed Description

Similar to Windows Semaphore Objects.

Macro Definition Documentation

#define OS_SEMAPHORE_TAG   0x73506852u

Definition at line 19 of file semaphore.h.

Typedef Documentation

typedef struct OSSemaphore OSSemaphore

Definition at line 17 of file semaphore.h.

Function Documentation

int32_t OSGetSemaphoreCount ( OSSemaphore semaphore)

Get the current semaphore count.

void OSInitSemaphore ( OSSemaphore semaphore,
int32_t  count 
)

Initialise semaphore object with count.

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

Initialise semaphore object with count and name.

int32_t OSSignalSemaphore ( OSSemaphore semaphore)

Increase the semaphore value.

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

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.
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.