Twilight Princess
Decompilation of The Legend of Zelda: Twilight Princess
Loading...
Searching...
No Matches
OSThread.h
Go to the documentation of this file.
1#ifndef OSTHREAD_H
2#define OSTHREAD_H
3
5
6#ifdef __cplusplus
7extern "C" {
8#endif
9
11typedef s32 OSPriority; // 0 highest, 31 lowest
12
13#define OS_THREAD_STATE_UNINITIALIZED 0
14#define OS_THREAD_STATE_READY 1
15#define OS_THREAD_STATE_RUNNING 2
16#define OS_THREAD_STATE_WAITING 4
17#define OS_THREAD_STATE_DEAD 8
18
19#define OS_THREAD_ATTR_DETACH 0x0001u
20
21#define OS_THREAD_STACK_MAGIC 0xDEADBABE
22
23#define OS_PRIORITY_MIN 0 // highest
24#define OS_PRIORITY_MAX 31 // lowest
25#define OS_PRIORITY_IDLE OS_PRIORITY_MAX
26
27typedef struct OSThread OSThread;
30
31typedef struct OSMutex OSMutex;
33typedef struct OSMutexLink OSMutexLink;
34typedef struct OSCond OSCond;
35
40
42 /* 0x0 */ OSThread* head;
43 /* 0x4 */ OSThread* tail;
44};
45
50
55
75
77
80
83void __OSThreadInit(void);
89static void UnsetRun(OSThread* thread);
91static OSThread* SetEffectivePriority(OSThread* thread, s32 priority);
92void __OSPromoteThread(OSThread* thread, s32 priority);
94void __OSReschedule(void);
95void OSYieldThread(void);
96BOOL OSCreateThread(OSThread* thread, void* func, void* param, void* stackBase, u32 stackSize,
97 s32 priority, u16 attribute);
98void OSExitThread(void* exitValue);
99void OSCancelThread(OSThread* thread);
100void OSDetachThread(OSThread* thread);
103void OSSleepThread(OSThreadQueue* queue);
104void OSWakeupThread(OSThreadQueue* queue);
105s32 OSSetThreadPriority(OSThread* thread, s32 priority);
107static s32 CheckThreadQueue(OSThreadQueue* thread);
109static void OSClearStack(u8 value);
110
111#ifdef __cplusplus
112};
113#endif
114
115#endif /* OSTHREAD_H */
BOOL OSIsThreadTerminated(OSThread *thread)
Definition OSThread.c:207
s32 OSResumeThread(OSThread *thread)
Definition OSThread.c:565
void OSWakeupThread(OSThreadQueue *queue)
Definition OSThread.c:643
OSSwitchThreadCallback OSSetSwitchThreadCallback(OSSwitchThreadCallback func)
Definition OSThread.c:96
s32 OSSetThreadPriority(OSThread *thread, s32 priority)
Definition OSThread.c:660
s32 OSCheckActiveThreads(void)
Definition OSThread.c:724
OSThread * OSGetCurrentThread(void)
Definition OSThread.c:202
void __OSReschedule(void)
Definition OSThread.c:407
void OSSleepThread(OSThreadQueue *queue)
Definition OSThread.c:627
void OSCancelThread(OSThread *thread)
Definition OSThread.c:506
void OSYieldThread(void)
Definition OSThread.c:416
s32 OSPriority
Definition OSThread.h:11
static void UnsetRun(OSThread *thread)
void OSDetachThread(OSThread *thread)
Definition OSThread.c:549
void __OSPromoteThread(OSThread *thread, s32 priority)
Definition OSThread.c:322
s32 OSDisableScheduler(void)
Definition OSThread.c:214
static OSThread * SetEffectivePriority(OSThread *thread, s32 priority)
OSThreadQueue OS_THREAD_QUEUE AT_ADDRESS(0x800000DC)
static OSThread * SelectThread(BOOL yield)
void(* OSSwitchThreadCallback)(OSThread *from, OSThread *to)
Definition OSThread.h:76
s32 OSGetThreadPriority(OSThread *thread)
Definition OSThread.c:679
void OSInitThreadQueue(OSThreadQueue *queue)
Definition OSThread.c:196
BOOL OSCreateThread(OSThread *thread, void *func, void *param, void *stackBase, u32 stackSize, s32 priority, u16 attribute)
Definition OSThread.c:425
void __OSThreadInit(void)
Definition OSThread.c:159
s32 OSEnableScheduler(void)
Definition OSThread.c:222
static void DefaultSwitchThreadCallback(OSThread *from, OSThread *to)
static void OSClearStack(u8 value)
Definition OSThread.c:925
s32 OSSuspendThread(OSThread *thread)
Definition OSThread.c:595
u16 OSThreadState
Definition OSThread.h:10
static s32 CheckThreadQueue(OSThreadQueue *thread)
Definition OSThread.c:684
s32 __OSGetEffectivePriority(OSThread *thread)
Definition OSThread.c:268
void OSExitThread(void *exitValue)
Definition OSThread.c:479
T cLib_calcTimer(T *value)
Definition c_lib.h:74
Definition OSMutex.h:17
Definition OSContext.h:137
Definition OSThread.h:51
OSMutex * tail
Definition OSThread.h:53
OSMutex * head
Definition OSThread.h:52
Definition OSMutex.h:10
Definition OSThread.h:41
OSThread * tail
Definition OSThread.h:43
OSThread * head
Definition OSThread.h:42
Definition OSThread.h:56
void * exit_value
Definition OSThread.h:63
OSThreadLink active_threads_link
Definition OSThread.h:69
OSThreadState state
Definition OSThread.h:58
u16 attributes
Definition OSThread.h:59
s32 suspend_count
Definition OSThread.h:60
OSMutex * mutex
Definition OSThread.h:67
u8 * stack_base
Definition OSThread.h:70
s32 effective_priority
Definition OSThread.h:61
u32 base_priority
Definition OSThread.h:62
OSThreadQueue join_queue
Definition OSThread.h:66
u8 * error_code
Definition OSThread.h:72
OSMutexQueue owned_mutexes
Definition OSThread.h:68
u32 * stack_end
Definition OSThread.h:71
OSThreadLink link
Definition OSThread.h:65
OSThreadQueue * queue
Definition OSThread.h:64
void * data[2]
Definition OSThread.h:73
OSContext context
Definition OSThread.h:57
int BOOL
Definition types.h:27
unsigned long u32
Definition types.h:10
unsigned short u16
Definition types.h:9
signed long s32
Definition types.h:6
unsigned char u8
Definition types.h:8