2 #include <wiiu/types.h> 9 typedef struct OSThread OSThread;
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);
17 OS_THREAD_STATE_NONE = 0,
20 OS_THREAD_STATE_READY = 1 << 0,
23 OS_THREAD_STATE_RUNNING = 1 << 1,
26 OS_THREAD_STATE_WAITING = 1 << 2,
29 OS_THREAD_STATE_MORIBUND = 1 << 3,
31 typedef uint8_t OSThreadState;
33 enum OS_THREAD_REQUEST
35 OS_THREAD_REQUEST_NONE = 0,
36 OS_THREAD_REQUEST_SUSPEND = 1,
37 OS_THREAD_REQUEST_CANCEL = 2,
39 typedef uint32_t OSThreadRequest;
44 OS_THREAD_ATTRIB_AFFINITY_CPU0 = 1 << 0,
47 OS_THREAD_ATTRIB_AFFINITY_CPU1 = 1 << 1,
50 OS_THREAD_ATTRIB_AFFINITY_CPU2 = 1 << 2,
53 OS_THREAD_ATTRIB_AFFINITY_ANY = ((1 << 0) | (1 << 1) | (1 << 2)),
56 OS_THREAD_ATTRIB_DETACHED = 1 << 3,
59 OS_THREAD_ATTRIB_STACK_USAGE = 1 << 5
61 typedef uint8_t OSThreadAttributes;
63 #define OS_CONTEXT_TAG 0x4F53436F6E747874ull 77 uint32_t __unknown[0x5];
80 uint16_t spinLockCount;
97 typedef struct OSMutex OSMutex;
98 typedef struct OSFastMutex OSFastMutex;
134 #define OS_THREAD_TAG 0x74487244u 135 #pragma pack(push, 1) 136 typedef struct __attribute__ ((aligned (8))) OSThread
147 OSThreadAttributes attr;
153 int32_t suspendCounter;
159 int32_t basePriority;
164 uint32_t unknown0[0x9];
191 OSThreadEntryPointFn entryPoint;
193 uint32_t unknown1[0x77];
196 uint32_t specific[0x10];
206 void *userStackPointer;
209 OSThreadCleanupCallbackFn cleanupCallback;
212 OSThreadDeallocatorFn deallocator;
218 OSThreadRequest requestFlag;
224 int32_t suspendResult;
229 uint32_t unknown4[0x2B];
234 OSCancelThread(OSThread *thread);
235 int32_t OSCheckActiveThreads();
236 int32_t OSCheckThreadStackUsage(OSThread *thread);
237 void OSClearThreadStackUsage(OSThread *thread);
238 void OSContinueThread(OSThread *thread);
239 BOOL OSCreateThread(OSThread *thread, OSThreadEntryPointFn entry, int32_t argc,
char *argv,
240 void *stack, uint32_t stackSize, int32_t priority, OSThreadAttributes attributes);
241 void OSDetachThread(OSThread *thread);
242 void OSExitThread(int32_t result);
243 void OSGetActiveThreadLink(OSThread *thread,
OSThreadLink *link);
244 OSThread *OSGetCurrentThread();
245 OSThread *OSGetDefaultThread(uint32_t coreID);
246 uint32_t OSGetStackPointer();
247 uint32_t OSGetThreadAffinity(OSThread *thread);
248 const char *OSGetThreadName(OSThread *thread);
249 int32_t OSGetThreadPriority(OSThread *thread);
250 uint32_t OSGetThreadSpecific(uint32_t
id);
251 BOOL OSIsThreadSuspended(OSThread *thread);
252 BOOL OSIsThreadTerminated(OSThread *thread);
253 BOOL OSJoinThread(OSThread *thread,
int *threadResult);
254 int32_t OSResumeThread(OSThread *thread);
255 BOOL OSRunThread(OSThread *thread, OSThreadEntryPointFn entry,
int argc,
const char **argv);
256 BOOL OSSetThreadAffinity(OSThread *thread, uint32_t affinity);
257 BOOL OSSetThreadCancelState(BOOL state);
258 OSThreadCleanupCallbackFn OSSetThreadCleanupCallback(OSThread *thread,
259 OSThreadCleanupCallbackFn callback);
260 OSThreadDeallocatorFn OSSetThreadDeallocator(OSThread *thread, OSThreadDeallocatorFn deallocator);
261 void OSSetThreadName(OSThread *thread,
const char *name);
262 BOOL OSSetThreadPriority(OSThread *thread, int32_t priority);
263 BOOL OSSetThreadRunQuantum(OSThread *thread, uint32_t quantum);
264 void OSSetThreadSpecific(uint32_t
id, uint32_t value);
265 BOOL OSSetThreadStackUsage(OSThread *thread);
267 void OSSleepTicks(OSTime ticks);
268 uint32_t OSSuspendThread(OSThread *thread);
269 void OSTestThreadCancel();
271 void OSYieldThread();
273 void OSInitThreadQueueEx(
OSThreadQueue *queue,
void *parent);
uint64_t tag
Definition: thread.h:68