psl1ght
A free SDK for Sony's PS3 console
Loading...
Searching...
No Matches
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.
 
LV2_SYSCALL sysSemDestroy (sys_sem_t sem)
 Destroy a semaphore.
 
LV2_SYSCALL sysSemWait (sys_sem_t sem, u64 timeout_usec)
 Wait and reserve a semaphore.
 
LV2_SYSCALL sysSemTryWait (sys_sem_t sem)
 Reserve a semaphore (non-blocking).
 
LV2_SYSCALL sysSemPost (sys_sem_t sem, s32 count)
 Release a semaphore.
 
LV2_SYSCALL sysSemGetValue (sys_sem_t sem, s32 *count)
 Get the value of a semaphore.
 

Detailed Description

Semaphore management syscalls.

Definition in file sem.h.

Macro Definition Documentation

◆ SYS_SEM_ATTR_PROTOCOL

#define SYS_SEM_ATTR_PROTOCOL   0x0002

Default protocol for semaphore attributes.

Definition at line 11 of file sem.h.

◆ SYS_SEM_ATTR_PSHARED

#define SYS_SEM_ATTR_PSHARED   0x0200

Default sharing policy for semaphore attributes.

Definition at line 13 of file sem.h.

Typedef Documentation

◆ sys_sem_attr_t

typedef struct sys_sem_attr sys_sem_attr_t

Semaphore sttributes data structure.

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.

Definition at line 43 of file sem.h.

◆ sysSemDestroy()

LV2_SYSCALL sysSemDestroy ( sys_sem_t  sem)

Destroy a semaphore.

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

Definition at line 53 of file sem.h.

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

Definition at line 98 of file sem.h.

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

Definition at line 87 of file sem.h.

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

Definition at line 76 of file sem.h.

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

Definition at line 65 of file sem.h.