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

Lightweight mutex library. More...

#include <ppu-types.h>

Go to the source code of this file.

Data Structures

struct  sys_lwmutex
 Lightweight mutex data structure. More...
 
struct  sys_lwmutex_attr
 Lightweight mutex attributes data structure. More...
 

Macros

#define SYS_LWMUTEX_ATTR_PROTOCOL   0x0002
 
#define SYS_LWMUTEX_ATTR_RECURSIVE   0x0010
 Lightweight mutex is recursive.
 
#define SYS_LWMUTEX_PROTOCOL_FIFO   1
 FIFO lightweight mutex scheduling policy.
 
#define SYS_LWMUTEX_PROTOCOL_PRIO   2
 Priority-based lightweight mutex scheduling policy.
 
#define SYS_LWMUTEX_PROTOCOL_PRIO_INHERIT   3
 Priority-based lightweight mutex scheduling policy with inheritance.
 
#define SYS_LWMUTEX_ATTR_RECURSIVE   0x0010
 Lightweight mutex is recursive.
 
#define SYS_LWMUTEX_ATTR_NOT_RECURSIVE   0x0020
 Lightweight mutex is not recursive.
 

Typedefs

typedef struct sys_lwmutex sys_lwmutex_t
 Lightweight mutex data structure.
 
typedef struct sys_lwmutex_attr sys_lwmutex_attr_t
 Lightweight mutex attributes data structure.
 

Functions

s32 sysLwMutexCreate (sys_lwmutex_t *mutex, const sys_lwmutex_attr_t *attr)
 Create a lightweight mutex. More...
 
s32 sysLwMutexDestroy (sys_lwmutex_t *mutex)
 Destroy a lightweight mutex. More...
 
s32 sysLwMutexLock (sys_lwmutex_t *mutex, u64 timeout)
 Lock a lightweight mutex. More...
 
s32 sysLwMutexTryLock (sys_lwmutex_t *mutex)
 Try to lock a lightweight mutex (non-blocking). More...
 
s32 sysLwMutexUnlock (sys_lwmutex_t *mutex)
 Unlock a previously locked lightweight mutex. More...
 

Detailed Description

Lightweight mutex library.

Function Documentation

◆ sysLwMutexCreate()

s32 sysLwMutexCreate ( sys_lwmutex_t mutex,
const sys_lwmutex_attr_t attr 
)

Create a lightweight mutex.

Parameters
mutexPointer to the lightweight mutex structure to be initialized.
attrPointer to the lightweight mutex attributes.
Returns
zero if no error occured, nonzero otherwise.

◆ sysLwMutexDestroy()

s32 sysLwMutexDestroy ( sys_lwmutex_t mutex)

Destroy a lightweight mutex.

Parameters
mutexPointer to the lightweight mutex structure.
Returns
zero if no error occured, nonzero otherwise.

◆ sysLwMutexLock()

s32 sysLwMutexLock ( sys_lwmutex_t mutex,
u64  timeout 
)

Lock a lightweight mutex.

Parameters
mutexPointer to the lightweight mutex structure.
timeout_usecTimeout value in microseconds, or 0 if no timeout is used.
Returns
zero if the lightweight mutex was successfully locked, nonzero in case of error or if a timeout occured.

◆ sysLwMutexTryLock()

s32 sysLwMutexTryLock ( sys_lwmutex_t mutex)

Try to lock a lightweight mutex (non-blocking).

Parameters
mutexPointer to the lightweight mutex structure.
Returns
zero if the lightweight mutex was successfully locked, nonzero in case of error or if the lightweight mutex is already locked by another thread.

◆ sysLwMutexUnlock()

s32 sysLwMutexUnlock ( sys_lwmutex_t mutex)

Unlock a previously locked lightweight mutex.

Parameters
mutexPointer to the lightweight mutex structure.
Returns
zero if no error occured, nonzero otherwise.