psl1ght
A free SDK for Sony's PS3 console
thread.h
Go to the documentation of this file.
1 
5 #ifndef __SYS_THREAD_H__
6 #define __SYS_THREAD_H__
7 
8 #include <ppu-lv2.h>
9 #include <lv2/thread.h>
10 
12 #define THREAD_JOINABLE 1
13 
15 #define THREAD_INTERRUPT 2
16 
17 #ifdef __cplusplus
18  extern "C" {
19 #endif
20 
22 typedef struct _sys_ppu_thread_stack_t {
23  void *addr;
24  u32 size;
26 
39 s32 sysThreadCreate(sys_ppu_thread_t *threadid,void (*entry)(void *),void *arg,s32 priority,u64 stacksize,u64 flags,char *threadname);
40 
46 LV2_SYSCALL sysThreadJoin(sys_ppu_thread_t threadid,u64 *retval)
47 {
48  lv2syscall2(44,threadid,(u64)retval);;
49  return_to_user_prog(s32);
50 }
51 
55 LV2_SYSCALL sysThreadYield()
56 {
57  lv2syscall0(43);
58  return_to_user_prog(s32);
59 }
60 
65 LV2_SYSCALL sysThreadDetach(sys_ppu_thread_t threadid)
66 {
67  lv2syscall1(45,threadid);
68  return_to_user_prog(s32);
69 }
70 
76 LV2_SYSCALL sysThreadJoinState(s32 *joinable)
77 {
78  lv2syscall1(46,(u64)joinable);
79  return_to_user_prog(s32);
80 }
81 
87 LV2_SYSCALL sysThreadSetPriority(sys_ppu_thread_t threadid,s32 prio)
88 {
89  lv2syscall2(47,threadid,prio);
90  return_to_user_prog(s32);
91 }
92 
98 LV2_SYSCALL sysThreadGetPriority(sys_ppu_thread_t threadid,s32 *prio)
99 {
100  lv2syscall2(48,threadid,(u64)prio);
101  return_to_user_prog(s32);
102 }
103 
109 LV2_SYSCALL sysThreadRename(sys_ppu_thread_t threadid,const char *name)
110 {
111  lv2syscall2(56,threadid,(u64)name);
112  return_to_user_prog(s32);
113 }
114 
119 LV2_SYSCALL sysThreadRecoverPageFault(sys_ppu_thread_t threadid)
120 {
121  lv2syscall1(57,threadid);
122  return_to_user_prog(s32);
123 }
124 
130 {
131  struct _sys_ppu_thread_stack_t_32 {
132  u32 addr;
133  u32 size;
134  } info32;
135 
136  lv2syscall1(49,(u64)(&info32));
137  info->addr = (void*)((u64)info32.addr);
138  info->size = info32.size;
139 
140  return_to_user_prog(s32);
141 }
142 
143 #ifdef __cplusplus
144  }
145 #endif
146 
147 #endif
PPU thread library.
LV2_SYSCALL sysThreadJoin(sys_ppu_thread_t threadid, u64 *retval)
Wait for the termination of a joinable PPU thread.
Definition: thread.h:46
PPU thread stack data structure.
Definition: thread.h:22
LV2_SYSCALL sysThreadGetStackInformation(sys_ppu_thread_stack_t *info)
Get stack information from the current PPU thread.
Definition: thread.h:129
LV2_SYSCALL sysThreadSetPriority(sys_ppu_thread_t threadid, s32 prio)
Set the priority of a PPU thread.
Definition: thread.h:87
LV2_SYSCALL sysThreadJoinState(s32 *joinable)
Test the joinable or detached state of the calling PPU thread.
Definition: thread.h:76
s32 sysThreadCreate(sys_ppu_thread_t *threadid, void(*entry)(void *), void *arg, s32 priority, u64 stacksize, u64 flags, char *threadname)
Create a PPU thread.
LV2_SYSCALL sysThreadYield()
Preempt the calling PPU thread.
Definition: thread.h:55
LV2_SYSCALL sysThreadRename(sys_ppu_thread_t threadid, const char *name)
Rename a PPU thread.
Definition: thread.h:109
LV2_SYSCALL sysThreadGetPriority(sys_ppu_thread_t threadid, s32 *prio)
Get the priority of a PPU thread.
Definition: thread.h:98
u32 size
stack size in bytes
Definition: thread.h:24
struct _sys_ppu_thread_stack_t sys_ppu_thread_stack_t
PPU thread stack data structure.
void * addr
pointer to the stack buffer
Definition: thread.h:23
LV2_SYSCALL sysThreadRecoverPageFault(sys_ppu_thread_t threadid)
Recover a PPU thread after a page fault.
Definition: thread.h:119
LV2_SYSCALL sysThreadDetach(sys_ppu_thread_t threadid)
Make a PPU thread detached (non-joinable).
Definition: thread.h:65