mirror of
https://github.com/zeldaret/mm.git
synced 2026-07-27 06:44:55 -04:00
Decompile {g,s}etthreadpri.c
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
#include <osint.h>
|
||||
|
||||
OSPri osGetThreadPri(OSThread* t) {
|
||||
if (t == NULL) {
|
||||
t = __osRunningThread;
|
||||
}
|
||||
return t->priority;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
#include <osint.h>
|
||||
|
||||
void osSetThreadPri(OSThread* t, OSPri p) {
|
||||
register u32 saveMask;
|
||||
|
||||
saveMask = __osDisableInt();
|
||||
|
||||
if (t == NULL) {
|
||||
t = __osRunningThread;
|
||||
}
|
||||
|
||||
if (t->priority != p) {
|
||||
t->priority = p;
|
||||
|
||||
if (t != __osRunningThread && t->state != 1) {
|
||||
__osDequeueThread(t->queue, t);
|
||||
__osEnqueueThread(t->queue, t);
|
||||
}
|
||||
|
||||
if (__osRunningThread->priority < __osRunQueue->priority) {
|
||||
__osRunningThread->state = 2;
|
||||
__osEnqueueAndYield(&__osRunQueue);
|
||||
}
|
||||
}
|
||||
|
||||
__osRestoreInt(saveMask);
|
||||
}
|
||||
Reference in New Issue
Block a user