1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-07 14:50:15 +00:00

First proper commit.

This commit is contained in:
Jack Walker 2020-03-17 00:31:30 -04:00
parent be78236d36
commit 087f561f77
14086 changed files with 1200489 additions and 1 deletions

View file

@ -0,0 +1,42 @@
#include <global.h>
void osStartThread(OSThread* thread)
{
register u32 s0 = __osDisableInt();
switch (thread->state)
{
case 8:
thread->state = 2;
__osEnqueueThread(&__osRunQueue, thread);
break;
case 1:
if (thread->queue == NULL || thread->queue == &__osRunQueue)
{
thread->state = 2;
__osEnqueueThread(&__osRunQueue, thread);
}
else
{
thread->state = 8;
__osEnqueueThread(thread->queue, thread);
__osEnqueueThread(&__osRunQueue, __osPopThread(thread->queue));
}
break;
}
if (__osRunningThread == NULL)
{
__osDispatchThread();
}
else
{
if (__osRunningThread->priority < __osRunQueue->priority)
{
__osRunningThread->state = 2;
__osEnqueueAndYield(&__osRunQueue);
}
}
__osRestoreInt(s0);
}