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

Lightweight condition variable library. More...

#include <ppu-types.h>
#include <lv2/mutex.h>

Go to the source code of this file.

Data Structures

struct  sys_lwcond
 Lightweight condition variable data structure. More...
 
struct  sys_lwcond_attr
 Lightweight condition variable attributes data structure. More...
 

Typedefs

typedef struct sys_lwcond sys_lwcond_t
 Lightweight condition variable data structure.
 
typedef struct sys_lwcond_attr sys_lwcond_attr_t
 Lightweight condition variable attributes data structure.
 

Functions

s32 sysLwCondCreate (sys_lwcond_t *lwcond, sys_lwmutex_t *lwmutex, sys_lwcond_attr_t *attr)
 Create a lightweight condition variable. More...
 
s32 sysLwCondDestroy (sys_lwcond_t *lwcond)
 Destroy a lightweight condition variable. More...
 
s32 sysLwCondWait (sys_lwcond_t *lwcond, u64 timeout_usec)
 Wait for a lightweight condition variable to be signaled. More...
 
s32 sysLwCondSignal (sys_lwcond_t *lwcond)
 Signal a lightweight condition variable. More...
 
s32 sysLwCondSignalTo (sys_lwcond_t *lwcond, sys_ppu_thread_t thr)
 Signal a lightweight condition variable to a specific PPU thread. More...
 
s32 sysLwCondSignalAll (sys_lwcond_t *lwcond)
 Signal a lightweight condition variable to all waiting PPU threads. More...
 

Detailed Description

Lightweight condition variable library.

Function Documentation

◆ sysLwCondCreate()

s32 sysLwCondCreate ( sys_lwcond_t lwcond,
sys_lwmutex_t lwmutex,
sys_lwcond_attr_t attr 
)

Create a lightweight condition variable.

Parameters
lwcondPointer to storage for the created lightweight condition variable.
lwmutexPointer to the associated lightweight mutex.
attrPointer to the attributes data structure.
Returns
zero if no error occured, nonzero otherwise.

◆ sysLwCondDestroy()

s32 sysLwCondDestroy ( sys_lwcond_t lwcond)

Destroy a lightweight condition variable.

Parameters
lwcondPointer to the allocated lightweight condition variable.
Returns
zero if no error occured, nonzero otherwise.

◆ sysLwCondSignal()

s32 sysLwCondSignal ( sys_lwcond_t lwcond)

Signal a lightweight condition variable.

Parameters
lwcondPointer to the allocated lightweight condition variable.
Returns
zero if no error occured, nonzero otherwise.

◆ sysLwCondSignalAll()

s32 sysLwCondSignalAll ( sys_lwcond_t lwcond)

Signal a lightweight condition variable to all waiting PPU threads.

Parameters
lwcondPointer to the allocated lightweight condition variable.
Returns
zero if no error occured, nonzero otherwise.

◆ sysLwCondSignalTo()

s32 sysLwCondSignalTo ( sys_lwcond_t lwcond,
sys_ppu_thread_t  thr 
)

Signal a lightweight condition variable to a specific PPU thread.

Parameters
lwcondPointer to the allocated lightweight condition variable.
thrThe PPU thread id.
Returns
zero if no error occured, nonzero otherwise.

◆ sysLwCondWait()

s32 sysLwCondWait ( sys_lwcond_t lwcond,
u64  timeout_usec 
)

Wait for a lightweight condition variable to be signaled.

The associated lightweight mutex must have been previously locked by the calling thread. This function atomically unlocks the mutex and waits for the condition variable to be signaled. Before returning to the calling thread, this function re-acquires the mutex.

Parameters
lwcondPointer to the allocated lightweight condition variable.
timeout_usecTimeout value in microseconds, or 0 if no timeout is used.
Returns
zero if the lightweight condition variable was signaled, nonzero in case of error or if a timeout occured.