mirror of
https://gitlab.com/ryandwyer/perfect-dark
synced 2026-08-18 13:13:11 -04:00
28 lines
562 B
C
28 lines
562 B
C
#include <libultra_internal.h>
|
|
#include "data.h"
|
|
|
|
void osSetThreadPri(OSThread *t, OSPri pri)
|
|
{
|
|
register u32 saveMask = __osDisableInt();
|
|
|
|
if (t == NULL) {
|
|
t = __osRunningThread;
|
|
}
|
|
|
|
if (t->priority != pri) {
|
|
t->priority = pri;
|
|
|
|
if (t != __osRunningThread && t->state != OS_STATE_STOPPED) {
|
|
__osDequeueThread(t->queue, t);
|
|
__osEnqueueThread(t->queue, t);
|
|
}
|
|
|
|
if (__osRunningThread->priority < __osRunQueue->priority) {
|
|
__osRunningThread->state = OS_STATE_RUNNABLE;
|
|
__osEnqueueAndYield(&__osRunQueue);
|
|
}
|
|
}
|
|
|
|
__osRestoreInt(saveMask);
|
|
}
|