The first commit

This commit is contained in:
Banjo Kazooie
2022-07-15 17:09:41 -05:00
commit dd13d34074
1087 changed files with 391897 additions and 0 deletions

40
src/done/startthread.c Normal file
View File

@@ -0,0 +1,40 @@
#include <ultra64.h>
#include "osint.h"
void osStartThread(OSThread *t)
{
register u32 saveMask = __osDisableInt();
switch (t->state)
{
case OS_STATE_WAITING:
t->state = OS_STATE_RUNNABLE;
__osEnqueueThread(&__osRunQueue, t);
break;
case OS_STATE_STOPPED:
if (t->queue == NULL || t->queue == &__osRunQueue)
{
t->state = OS_STATE_RUNNABLE;
__osEnqueueThread(&__osRunQueue, t);
}
else
{
t->state = OS_STATE_WAITING;
__osEnqueueThread(t->queue, t);
__osEnqueueThread(&__osRunQueue, __osPopThread(t->queue));
}
break;
}
if (__osRunningThread == NULL)
{
__osDispatchThread();
}
else
{
if (__osRunningThread->priority < __osRunQueue->priority)
{
__osRunningThread->state = OS_STATE_RUNNABLE;
__osEnqueueAndYield(&__osRunQueue);
}
}
__osRestoreInt(saveMask);
}