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:
parent
be78236d36
commit
087f561f77
14086 changed files with 1200489 additions and 1 deletions
42
src/libultra_boot_O1/osStartThread.c
Normal file
42
src/libultra_boot_O1/osStartThread.c
Normal 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);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue