RetroArch
thread.h
Go to the documentation of this file.
1 #pragma once
2 #include <wiiu/types.h>
3 #include "time.h"
4 
5 #ifdef __cplusplus
6 extern "C" {
7 #endif
8 
9 typedef struct OSThread OSThread;
10 
11 typedef int (*OSThreadEntryPointFn)(int argc, const char **argv);
12 typedef void (*OSThreadCleanupCallbackFn)(OSThread *thread, void *stack);
13 typedef void (*OSThreadDeallocatorFn)(OSThread *thread, void *stack);
14 
16 {
18 
21 
24 
27 
30 };
32 
34 {
38 };
40 
42 {
45 
48 
51 
53  OS_THREAD_ATTRIB_AFFINITY_ANY = ((1 << 0) | (1 << 1) | (1 << 2)),
54 
57 
60 };
62 
63 #define OS_CONTEXT_TAG 0x4F53436F6E747874ull
64 
65 typedef struct OSContext
66 {
69 
79  double fpr[32];
84  double psf[32];
95 } OSContext;
96 
97 typedef struct OSMutex OSMutex;
98 typedef struct OSFastMutex OSFastMutex;
99 
100 typedef struct OSMutexQueue
101 {
104  void *parent;
106 } OSMutexQueue;
107 
108 typedef struct OSFastMutexQueue
109 {
113 
114 
115 typedef struct
116 {
119 } OSThreadLink;
120 
121 typedef struct
122 {
125  void *parent;
127 } OSThreadQueue;
128 
129 typedef struct
130 {
134 
135 #define OS_THREAD_TAG 0x74487244u
136 #pragma pack(push, 1)
137 typedef struct OSThread
138 {
140 
143 
146 
149 
152 
155 
158 
161 
164 
166 
169 
172 
175 
178 
181 
184 
186  void *stackStart;
187 
189  void *stackEnd;
190 
193 
195 
198 
200 
202  const char *name;
203 
205 
208 
211 
214 
217 
220 
223 
226 
229 
231 } OSThread;
232 #pragma pack(pop)
233 
234 void
235 OSCancelThread(OSThread *thread);
238 void OSClearThreadStackUsage(OSThread *thread);
239 void OSContinueThread(OSThread *thread);
240 BOOL OSCreateThread(OSThread *thread, OSThreadEntryPointFn entry, int32_t argc, char *argv,
241  void *stack, uint32_t stackSize, int32_t priority, OSThreadAttributes attributes);
242 void OSDetachThread(OSThread *thread);
249 const char *OSGetThreadName(OSThread *thread);
254 BOOL OSJoinThread(OSThread *thread, int *threadResult);
256 BOOL OSRunThread(OSThread *thread, OSThreadEntryPointFn entry, int argc, const char **argv);
257 BOOL OSSetThreadAffinity(OSThread *thread, uint32_t affinity);
262 void OSSetThreadName(OSThread *thread, const char *name);
264 BOOL OSSetThreadRunQuantum(OSThread *thread, uint32_t quantum);
267 void OSSleepThread(OSThreadQueue *queue);
268 void OSSleepTicks(OSTime ticks);
270 void OSTestThreadCancel();
271 void OSWakeupThread(OSThreadQueue *queue);
272 void OSYieldThread();
273 void OSInitThreadQueue(OSThreadQueue *queue);
274 void OSInitThreadQueueEx(OSThreadQueue *queue, void *parent);
275 
276 #ifdef __cplusplus
277 }
278 #endif
uint32_t OSSuspendThread(OSThread *thread)
double psf[32]
Definition: thread.h:84
Definition: thread.h:129
BOOL OSJoinThread(OSThread *thread, int *threadResult)
int link(const char *oldpath, const char *newpath)
Definition: compat_ctype.c:438
const char * name
Definition: thread.h:202
Definition: thread.h:26
GLuint const GLchar * name
Definition: glext.h:6671
void OSDetachThread(OSThread *thread)
OSThreadQueue joinQueue
Definition: thread.h:174
uint32_t unknown3
Definition: thread.h:204
void * userStackPointer
Definition: thread.h:207
BOOL cancelState
Definition: thread.h:216
uint32_t mmcr1
Definition: thread.h:94
void OSWakeupThread(OSThreadQueue *queue)
OSThread * head
Definition: thread.h:123
void OSSetThreadName(OSThread *thread, const char *name)
OSFastMutex * tail
Definition: thread.h:111
int32_t basePriority
Definition: thread.h:160
Definition: thread.h:36
BOOL OSSetThreadStackUsage(OSThread *thread)
Definition: fastmutex.h:16
OSThreadCleanupCallbackFn cleanupCallback
Definition: thread.h:210
int32_t suspendCounter
Definition: thread.h:154
Definition: thread.h:37
OSThreadQueue suspendQueue
Definition: thread.h:228
OSThreadState state
Definition: thread.h:145
OSThreadDeallocatorFn OSSetThreadDeallocator(OSThread *thread, OSThreadDeallocatorFn deallocator)
BOOL OSSetThreadAffinity(OSThread *thread, uint32_t affinity)
uint32_t unknown0[0x9]
Definition: thread.h:165
Definition: thread.h:108
uint16_t id
Definition: thread.h:151
BOOL OSIsThreadTerminated(OSThread *thread)
OSThread * head
Definition: thread.h:131
OSThread * next
Definition: thread.h:118
int32_t suspendResult
Definition: thread.h:225
OSThreadLink link
Definition: thread.h:171
void OSInitThreadQueue(OSThreadQueue *queue)
struct OSMutexQueue OSMutexQueue
uint16_t state
Definition: thread.h:81
typedef void(__stdcall *PFN_DESTRUCTION_CALLBACK)(void *pData)
#define OSThreadQueue
Definition: gx_pthread.h:40
uint32_t mmcr0
Definition: thread.h:93
Definition: thread.h:59
uint32_t OSGetThreadSpecific(uint32_t id)
BOOL OSRunThread(OSThread *thread, OSThreadEntryPointFn entry, int argc, const char **argv)
Definition: thread.h:121
uint32_t __unknown
Definition: thread.h:105
uint32_t xer
Definition: thread.h:74
void OSTestThreadCancel()
uint32_t OSGetThreadAffinity(OSThread *thread)
uint32_t specific[0x10]
Definition: thread.h:197
OSThreadRequest requestFlag
Definition: thread.h:219
Definition: thread.h:100
uint32_t srr1
Definition: thread.h:76
void * parent
Definition: thread.h:104
static GX2AttribVar attributes[]
Definition: bokeh.c:713
void OSExitThread(int32_t result)
OSThreadQueue * queue
Definition: thread.h:168
void callback(s32 result, dvdcmdblk *block)
Definition: dvd.c:2293
OSFastMutex * head
Definition: thread.h:110
BOOL OSCreateThread(OSThread *thread, OSThreadEntryPointFn entry, int32_t argc, char *argv, void *stack, uint32_t stackSize, int32_t priority, OSThreadAttributes attributes)
int32_t needSuspend
Definition: thread.h:222
Definition: thread.h:20
OSThread * tail
Definition: thread.h:132
uint32_t gqr[8]
Definition: thread.h:82
Definition: thread.h:137
struct OSFastMutexQueue OSFastMutexQueue
Definition: thread.h:115
uint8_t OSThreadAttributes
Definition: thread.h:61
int32_t OSGetThreadPriority(OSThread *thread)
uint16_t spinLockCount
Definition: thread.h:80
uint32_t srr0
Definition: thread.h:75
Definition: thread.h:17
Definition: thread.h:29
void(* OSThreadDeallocatorFn)(OSThread *thread, void *stack)
Definition: thread.h:13
uint32_t pmc3
Definition: thread.h:91
Definition: thread.h:47
OSThread * prev
Definition: thread.h:117
OSContext context
Definition: thread.h:139
void OSInitThreadQueueEx(OSThreadQueue *queue, void *parent)
uint64_t tag
Definition: thread.h:68
static uint64_t state[MAX_PADS]
Definition: xenon360_input.c:33
Definition: thread.h:50
void OSSleepThread(OSThreadQueue *queue)
uint32_t tag
Definition: thread.h:142
void OSSetThreadSpecific(uint32_t id, uint32_t value)
const char * OSGetThreadName(OSThread *thread)
GLuint64EXT * result
Definition: glext.h:12211
OSThreadCleanupCallbackFn OSSetThreadCleanupCallback(OSThread *thread, OSThreadCleanupCallbackFn callback)
Definition: thread.h:56
OSThreadDeallocatorFn deallocator
Definition: thread.h:213
int32_t priority
Definition: thread.h:157
OSMutex * mutex
Definition: thread.h:177
uint8_t OSThreadState
Definition: thread.h:31
OSMutex * head
Definition: thread.h:102
uint32_t __unknown[0x5]
Definition: thread.h:77
int64_t OSTime
Definition: time.h:28
static const struct @104 priority[]
Definition: thread.h:35
OSThread * OSGetDefaultThread(uint32_t coreID)
signed int int32_t
Definition: stdint.h:123
void(* OSThreadCleanupCallbackFn)(OSThread *thread, void *stack)
Definition: thread.h:12
uint32_t __unknown1
Definition: thread.h:88
Definition: thread.h:44
OSMutexQueue mutexQueue
Definition: thread.h:180
void OSClearThreadStackUsage(OSThread *thread)
int32_t OSCheckThreadStackUsage(OSThread *thread)
Definition: thread.h:53
int32_t OSResumeThread(OSThread *thread)
uint32_t pmc4
Definition: thread.h:92
uint32_t OSThreadRequest
Definition: thread.h:39
struct OSThread OSThread
Definition: thread.h:9
unsigned int BOOL
Definition: gctypes.h:51
void * parent
Definition: thread.h:125
uint32_t unknown4[0x2B]
Definition: thread.h:230
void OSSleepTicks(OSTime ticks)
uint32_t __unknown
Definition: thread.h:126
uint32_t pmc1
Definition: thread.h:89
uint32_t cr
Definition: thread.h:71
int32_t exitValue
Definition: thread.h:163
uint32_t lr
Definition: thread.h:72
BOOL OSSetThreadRunQuantum(OSThread *thread, uint32_t quantum)
BOOL OSIsThreadSuspended(OSThread *thread)
uint64_t starttime
Definition: thread.h:86
OSThread * OSGetCurrentThread()
void OSCancelThread(OSThread *thread)
uint32_t pmc2
Definition: thread.h:90
BOOL OSSetThreadCancelState(BOOL state)
uint64_t coretime[3]
Definition: thread.h:85
GLsizei const GLfloat * value
Definition: glext.h:6709
int(* OSThreadEntryPointFn)(int argc, const char **argv)
Definition: thread.h:11
OSThreadEntryPointFn entryPoint
Definition: thread.h:192
uint32_t gpr[32]
Definition: thread.h:70
Definition: mutex.h:18
uint32_t fpscr
Definition: thread.h:78
OSThread * tail
Definition: thread.h:124
struct OSContext OSContext
OSThreadLink activeLink
Definition: thread.h:183
uint32_t __unknown0
Definition: thread.h:83
BOOL OSSetThreadPriority(OSThread *thread, int32_t priority)
OS_THREAD_REQUEST
Definition: thread.h:33
uint32_t unknown2
Definition: thread.h:199
void OSYieldThread()
OS_THREAD_ATTRIB
Definition: thread.h:41
void OSGetActiveThreadLink(OSThread *thread, OSThreadLink *link)
int32_t OSCheckActiveThreads()
void * stackEnd
Definition: thread.h:189
unsigned short uint16_t
Definition: stdint.h:125
void OSContinueThread(OSThread *thread)
Definition: thread.h:65
uint32_t ctr
Definition: thread.h:73
uint32_t OSGetStackPointer()
unsigned __int64 uint64_t
Definition: stdint.h:136
Definition: thread.h:23
OSMutex * tail
Definition: thread.h:103
unsigned char uint8_t
Definition: stdint.h:124
unsigned int uint32_t
Definition: stdint.h:126
void * stackStart
Definition: thread.h:186
OSThreadAttributes attr
Definition: thread.h:148
double fpr[32]
Definition: thread.h:79
uint32_t unknown1[0x77]
Definition: thread.h:194
OS_THREAD_STATE
Definition: thread.h:15
uint32_t error
Definition: thread.h:87