MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / __OSThreadInit

Function __OSThreadInit

src/dolphin/src/os/OSThread.c:104–140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102}
103
104void __OSThreadInit()
105{
106 OSThread* thread = &DefaultThread;
107 int prio;
108
109 thread->state = OS_THREAD_STATE_RUNNING;
110 thread->attr = OS_THREAD_ATTR_DETACH;
111 thread->priority = thread->base = 16;
112 thread->suspend = 0;
113 thread->val = (void*)-1;
114 thread->mutex = NULL;
115 OSInitThreadQueue(&thread->queueJoin);
116 OSInitMutexQueue(&thread->queueMutex);
117
118 __OSFPUContext = &thread->context;
119
120 OSClearContext(&thread->context);
121 OSSetCurrentContext(&thread->context);
122 thread->stackBase = (void*)_stack_addr;
123 thread->stackEnd = (void*)_stack_end;
124 *(thread->stackEnd) = OS_THREAD_STACK_MAGIC;
125
126 OSSetCurrentThread(thread);
127 OSClearStack(0);
128
129 RunQueueBits = 0;
130 RunQueueHint = FALSE;
131 for (prio = OS_PRIORITY_MIN; prio <= OS_PRIORITY_MAX; ++prio)
132 {
133 OSInitThreadQueue(&RunQueue[prio]);
134 }
135
136 OSInitThreadQueue(&__OSActiveThreadQueue);
137 AddTail(&__OSActiveThreadQueue, thread, linkActive);
138 OSClearContext(&IdleContext);
139 Reschedule = 0;
140}
141
142void OSInitThreadQueue(OSThreadQueue* queue)
143{

Callers 1

OSInitFunction · 0.85

Calls 4

OSInitThreadQueueFunction · 0.85
OSInitMutexQueueFunction · 0.85
OSSetCurrentThreadFunction · 0.85
OSClearStackFunction · 0.85

Tested by

no test coverage detected