libogc  v2.9.0
Macros | Typedefs | Functions
semaphore.h File Reference

Thread subsystem IV. More...

#include <gctypes.h>

Macros

#define LWP_SEM_NULL   0xffffffff
 

Typedefs

typedef u32 sem_t
 typedef for the semaphore handle
 

Functions

s32 LWP_SemDestroy (sem_t sem)
 Close and destroy a semaphore, release all threads and handles locked on this semaphore. More...
 
s32 LWP_SemGetValue (sem_t sem, u32 *value)
 return the current semaphore count More...
 
s32 LWP_SemInit (sem_t *sem, u32 start, u32 max)
 Initializes a semaphore. More...
 
s32 LWP_SemPost (sem_t sem)
 Count up semaphore counter and release lock if counter >0. More...
 
s32 LWP_SemWait (sem_t sem)
 Count down semaphore counter and enter lock if counter <=0. More...
 

Detailed Description

Thread subsystem IV.

Function Documentation

◆ LWP_SemDestroy()

s32 LWP_SemDestroy ( sem_t  sem)

Close and destroy a semaphore, release all threads and handles locked on this semaphore.

Parameters
[in]semhandle to the sem_t structure.
Returns
0 on success, <0 on error

◆ LWP_SemGetValue()

s32 LWP_SemGetValue ( sem_t  sem,
u32 value 
)

return the current semaphore count

Parameters
[in]semhandle to the sem_t structure.
[out]thecurrent value of the semaphore
Returns
0 on success, <0 on error

◆ LWP_SemInit()

s32 LWP_SemInit ( sem_t sem,
u32  start,
u32  max 
)

Initializes a semaphore.

Parameters
[out]sempointer to a sem_t handle.
[in]startstart count of the semaphore
[in]maxmaximum count of the semaphore
Returns
0 on success, <0 on error

◆ LWP_SemPost()

s32 LWP_SemPost ( sem_t  sem)

Count up semaphore counter and release lock if counter >0.

Parameters
[in]semhandle to the sem_t structure.
Returns
0 on success, <0 on error

◆ LWP_SemWait()

s32 LWP_SemWait ( sem_t  sem)

Count down semaphore counter and enter lock if counter <=0.

Parameters
[in]semhandle to the sem_t structure.
Returns
0 on success, <0 on error