psl1ght
A free SDK for Sony's PS3 console
mutex.h
Go to the documentation of this file.
1 
5 #ifndef __SYS_MUTEX_H__
6 #define __SYS_MUTEX_H__
7 
8 #include <ppu-lv2.h>
9 #include <lv2/mutex.h>
10 
12 #define SYS_MUTEX_PROTOCOL_FIFO 1
13 
14 #define SYS_MUTEX_PROTOCOL_PRIO 2
15 
16 #define SYS_MUTEX_PROTOCOL_PRIO_INHERIT 3
17 
19 #define SYS_MUTEX_ATTR_RECURSIVE 0x0010
20 
21 #define SYS_MUTEX_ATTR_NOT_RECURSIVE 0x0020
22 
24 #define SYS_MUTEX_ATTR_PSHARED 0x0200
25 
27 #define SYS_MUTEX_ATTR_ADAPTIVE 0x1000
28 
29 #define SYS_MUTEX_ATTR_NOT_ADAPTIVE 0x2000
30 
31 #ifdef __cplusplus
32  extern "C" {
33 #endif
34 
36 typedef struct sys_mutex_attr
37 {
63  u64 key;
65  s32 flags;
67  u32 _pad;
69  char name[8];
71 
77 LV2_SYSCALL sysMutexCreate(sys_mutex_t *mutex,const sys_mutex_attr_t *attr)
78 {
79  lv2syscall2(100,(u64)mutex,(u64)attr);
80  return_to_user_prog(s32);
81 }
82 
87 LV2_SYSCALL sysMutexDestroy(sys_mutex_t mutex)
88 {
89  lv2syscall1(101,mutex);
90  return_to_user_prog(s32);
91 }
92 
99 LV2_SYSCALL sysMutexLock(sys_mutex_t mutex,u64 timeout_usec)
100 {
101  lv2syscall2(102,mutex,timeout_usec);
102  return_to_user_prog(s32);
103 }
104 
110 LV2_SYSCALL sysMutexTryLock(sys_mutex_t mutex)
111 {
112  lv2syscall1(103,mutex);
113  return_to_user_prog(s32);
114 }
115 
120 LV2_SYSCALL sysMutexUnlock(sys_mutex_t mutex)
121 {
122  lv2syscall1(104,mutex);
123  return_to_user_prog(s32);
124 }
125 
126 #ifdef __cplusplus
127  }
128 #endif
129 
130 #endif
u32 attr_adaptive
Adaptive setting.
Definition: mutex.h:61
Mutex attributes data structure.
Definition: mutex.h:36
Lightweight mutex library.
u64 key
Mutex key.
Definition: mutex.h:63
LV2_SYSCALL sysMutexUnlock(sys_mutex_t mutex)
Unlock a previously locked mutex.
Definition: mutex.h:120
char name[8]
Mutex name.
Definition: mutex.h:69
u32 attr_pshared
Sharing policy (only known value for it is SYS_MUTEX_ATTR_PSHARED)
Definition: mutex.h:54
LV2_SYSCALL sysMutexCreate(sys_mutex_t *mutex, const sys_mutex_attr_t *attr)
Create a mutex.
Definition: mutex.h:77
struct sys_mutex_attr sys_mutex_attr_t
Mutex attributes data structure.
LV2_SYSCALL sysMutexLock(sys_mutex_t mutex, u64 timeout_usec)
Lock a mutex.
Definition: mutex.h:99
u32 _pad
Unused padding element.
Definition: mutex.h:67
LV2_SYSCALL sysMutexTryLock(sys_mutex_t mutex)
Try to lock a mutex (non-blocking).
Definition: mutex.h:110
u32 attr_recursive
Recursive setting.
Definition: mutex.h:52
u32 attr_protocol
Scheduling policy.
Definition: mutex.h:45
s32 flags
Mutex flags.
Definition: mutex.h:65
LV2_SYSCALL sysMutexDestroy(sys_mutex_t mutex)
Destroy a mutex.
Definition: mutex.h:87