psl1ght
A free SDK for Sony's PS3 console
Data Structures | Macros | Typedefs | Functions
sem.h File Reference

Semaphore management syscalls. More...

#include <ppu-lv2.h>

Go to the source code of this file.

Data Structures

struct  sys_sem_attr
 Semaphore sttributes data structure. More...
 

Macros

#define SYS_SEM_ATTR_PROTOCOL   0x0002
 Default protocol for semaphore attributes.
 
#define SYS_SEM_ATTR_PSHARED   0x0200
 Default sharing policy for semaphore attributes.
 

Typedefs

typedef struct sys_sem_attr sys_sem_attr_t
 Semaphore sttributes data structure.
 

Functions

LV2_SYSCALL sysSemCreate (sys_sem_t *sem, const sys_sem_attr_t *attr, s32 initial_val, s32 max_val)
 Create a semaphore. More...
 
LV2_SYSCALL sysSemDestroy (sys_sem_t sem)
 Destroy a semaphore. More...
 
LV2_SYSCALL sysSemWait (sys_sem_t sem, u64 timeout_usec)
 Wait and reserve a semaphore. More...
 
LV2_SYSCALL sysSemTryWait (sys_sem_t sem)
 Reserve a semaphore (non-blocking). More...
 
LV2_SYSCALL sysSemPost (sys_sem_t sem, s32 count)
 Release a semaphore. More...
 
LV2_SYSCALL sysSemGetValue (sys_sem_t sem, s32 *count)
 Get the value of a semaphore. More...
 

Detailed Description

Semaphore management syscalls.

Function Documentation

◆ sysSemCreate()

LV2_SYSCALL sysSemCreate ( sys_sem_t *  sem,
const sys_sem_attr_t attr,
s32  initial_val,
s32  max_val 
)

Create a semaphore.

Parameters
semPointer to storage to the semaphore id.
attrPointer to the semaphore attributes.
initial_valInitial value.
max_valMaximum value.
Returns
zero if no error occured, nonzero otherwise.

◆ sysSemDestroy()

LV2_SYSCALL sysSemDestroy ( sys_sem_t  sem)

Destroy a semaphore.

Parameters
semThe semaphore id.
Returns
zero if no error occured, nonzero otherwise.

◆ sysSemGetValue()

LV2_SYSCALL sysSemGetValue ( sys_sem_t  sem,
s32 *  count 
)

Get the value of a semaphore.

Parameters
semThe semaphore id.
countPointer to storage for the semaphore value.
Returns
zero if no error occured, nonzero otherwise.

◆ sysSemPost()

LV2_SYSCALL sysSemPost ( sys_sem_t  sem,
s32  count 
)

Release a semaphore.

Parameters
semThe semaphore id.
countIncrement value.
Returns
zero if no error occured, nonzero otherwise.

◆ sysSemTryWait()

LV2_SYSCALL sysSemTryWait ( sys_sem_t  sem)

Reserve a semaphore (non-blocking).

Parameters
semThe semaphore id.
Returns
zero if the semaphore was successfully reserved, nonzero in case of error or if the semaphore value is below 1.

◆ sysSemWait()

LV2_SYSCALL sysSemWait ( sys_sem_t  sem,
u64  timeout_usec 
)

Wait and reserve a semaphore.

Parameters
semThe semaphore id.
timeout_usecTimeout value in microseconds, or 0 if no timeout is used.
Returns
zero if the semaphore was successfully reserved, nonzero in case of error or if a timeout occured.