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

Mutual exclusion (mutex) syscalls. More...

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

Go to the source code of this file.

Data Structures

struct  sys_mutex_attr
 Mutex attributes data structure. More...
 

Macros

#define SYS_MUTEX_PROTOCOL_FIFO   1
 FIFO mutex scheduling policy.
 
#define SYS_MUTEX_PROTOCOL_PRIO   2
 Priority-based mutex scheduling policy.
 
#define SYS_MUTEX_PROTOCOL_PRIO_INHERIT   3
 Priority-based mutex scheduling policy with inheritance.
 
#define SYS_MUTEX_ATTR_RECURSIVE   0x0010
 Mutex is recursive.
 
#define SYS_MUTEX_ATTR_NOT_RECURSIVE   0x0020
 Mutex is not recursive.
 
#define SYS_MUTEX_ATTR_PSHARED   0x0200
 Default sharing policy for mutex attributes.
 
#define SYS_MUTEX_ATTR_ADAPTIVE   0x1000
 Mutex is adaptive.
 
#define SYS_MUTEX_ATTR_NOT_ADAPTIVE   0x2000
 Mutex is not adaptive.
 

Typedefs

typedef struct sys_mutex_attr sys_mutex_attr_t
 Mutex attributes data structure.
 

Functions

LV2_SYSCALL sysMutexCreate (sys_mutex_t *mutex, const sys_mutex_attr_t *attr)
 Create a mutex. More...
 
LV2_SYSCALL sysMutexDestroy (sys_mutex_t mutex)
 Destroy a mutex. More...
 
LV2_SYSCALL sysMutexLock (sys_mutex_t mutex, u64 timeout_usec)
 Lock a mutex. More...
 
LV2_SYSCALL sysMutexTryLock (sys_mutex_t mutex)
 Try to lock a mutex (non-blocking). More...
 
LV2_SYSCALL sysMutexUnlock (sys_mutex_t mutex)
 Unlock a previously locked mutex. More...
 

Detailed Description

Mutual exclusion (mutex) syscalls.

Function Documentation

◆ sysMutexCreate()

LV2_SYSCALL sysMutexCreate ( sys_mutex_t *  mutex,
const sys_mutex_attr_t attr 
)

Create a mutex.

Parameters
mutexPointer to storage for the mutex id.
attrPointer to the mutex attributes.
Returns
zero if no error occured, nonzero otherwise.

◆ sysMutexDestroy()

LV2_SYSCALL sysMutexDestroy ( sys_mutex_t  mutex)

Destroy a mutex.

Parameters
mutexThe mutex id.
Returns
zero if no error occured, nonzero otherwise.

◆ sysMutexLock()

LV2_SYSCALL sysMutexLock ( sys_mutex_t  mutex,
u64  timeout_usec 
)

Lock a mutex.

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

◆ sysMutexTryLock()

LV2_SYSCALL sysMutexTryLock ( sys_mutex_t  mutex)

Try to lock a mutex (non-blocking).

Parameters
mutexThe mutex id.
Returns
zero if the mutex was successfully locked, nonzero in case of error or if the mutex is already locked by another thread.

◆ sysMutexUnlock()

LV2_SYSCALL sysMutexUnlock ( sys_mutex_t  mutex)

Unlock a previously locked mutex.

Parameters
mutexThe mutex id.
Returns
zero if no error occured, nonzero otherwise.