psl1ght
A free SDK for Sony's PS3 console
Loading...
Searching...
No Matches
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_NOT_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.
 
#define sysMutexAttrInitialize(x)
 

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.
 
LV2_SYSCALL sysMutexDestroy (sys_mutex_t mutex)
 Destroy a mutex.
 
LV2_SYSCALL sysMutexLock (sys_mutex_t mutex, u64 timeout_usec)
 Lock a mutex.
 
LV2_SYSCALL sysMutexTryLock (sys_mutex_t mutex)
 Try to lock a mutex (non-blocking).
 
LV2_SYSCALL sysMutexUnlock (sys_mutex_t mutex)
 Unlock a previously locked mutex.
 

Detailed Description

Mutual exclusion (mutex) syscalls.

Definition in file mutex.h.

Macro Definition Documentation

◆ SYS_MUTEX_ATTR_ADAPTIVE

#define SYS_MUTEX_ATTR_ADAPTIVE   0x1000

Mutex is adaptive.

Definition at line 27 of file mutex.h.

◆ SYS_MUTEX_ATTR_NOT_ADAPTIVE

#define SYS_MUTEX_ATTR_NOT_ADAPTIVE   0x2000

Mutex is not adaptive.

Definition at line 29 of file mutex.h.

◆ SYS_MUTEX_ATTR_NOT_PSHARED

#define SYS_MUTEX_ATTR_NOT_PSHARED   0x0200

Default sharing policy for mutex attributes.

Definition at line 24 of file mutex.h.

◆ SYS_MUTEX_ATTR_NOT_RECURSIVE

#define SYS_MUTEX_ATTR_NOT_RECURSIVE   0x0020

Mutex is not recursive.

Definition at line 21 of file mutex.h.

◆ SYS_MUTEX_ATTR_RECURSIVE

#define SYS_MUTEX_ATTR_RECURSIVE   0x0010

Mutex is recursive.

Definition at line 19 of file mutex.h.

◆ SYS_MUTEX_PROTOCOL_FIFO

#define SYS_MUTEX_PROTOCOL_FIFO   1

FIFO mutex scheduling policy.

Definition at line 12 of file mutex.h.

◆ SYS_MUTEX_PROTOCOL_PRIO

#define SYS_MUTEX_PROTOCOL_PRIO   2

Priority-based mutex scheduling policy.

Definition at line 14 of file mutex.h.

◆ SYS_MUTEX_PROTOCOL_PRIO_INHERIT

#define SYS_MUTEX_PROTOCOL_PRIO_INHERIT   3

Priority-based mutex scheduling policy with inheritance.

Definition at line 16 of file mutex.h.

◆ sysMutexAttrInitialize

#define sysMutexAttrInitialize (   x)
Value:
do{ \
x.attr_protocol = SYS_MUTEX_PROTOCOL_PRIO; \
x.attr_recursive = SYS_MUTEX_ATTR_NOT_RECURSIVE; \
x.attr_pshared = SYS_MUTEX_ATTR_NOT_PSHARED; \
x.attr_adaptive = SYS_MUTEX_ATTR_NOT_ADAPTIVE; \
x.key = 0; \
x.flags = 0; \
x.name[0] = '\0'; \
}while(0)
#define SYS_MUTEX_ATTR_NOT_RECURSIVE
Mutex is not recursive.
Definition mutex.h:21
#define SYS_MUTEX_ATTR_NOT_PSHARED
Default sharing policy for mutex attributes.
Definition mutex.h:24
#define SYS_MUTEX_PROTOCOL_PRIO
Priority-based mutex scheduling policy.
Definition mutex.h:14
#define SYS_MUTEX_ATTR_NOT_ADAPTIVE
Mutex is not adaptive.
Definition mutex.h:29

Definition at line 72 of file mutex.h.

Typedef Documentation

◆ sys_mutex_attr_t

Mutex attributes data structure.

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.

Definition at line 88 of file mutex.h.

◆ sysMutexDestroy()

LV2_SYSCALL sysMutexDestroy ( sys_mutex_t  mutex)

Destroy a mutex.

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

Definition at line 98 of file mutex.h.

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

Definition at line 110 of file mutex.h.

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

Definition at line 121 of file mutex.h.

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

Definition at line 131 of file mutex.h.