osSetThreadPri.c (732B)
1 #include "libultra_internal.h" 2 3 void osSetThreadPri(OSThread *thread, OSPri pri) { 4 register u32 int_disabled = __osDisableInt(); 5 if (thread == NULL) { 6 thread = __osRunningThread; 7 } 8 9 if (thread->priority != pri) { 10 thread->priority = pri; 11 if (thread != __osRunningThread) { 12 if (thread->state != OS_STATE_STOPPED) { 13 __osDequeueThread(thread->queue, thread); 14 __osEnqueueThread(thread->queue, thread); 15 } 16 } 17 if (__osRunningThread->priority < __osRunQueue->priority) { 18 __osRunningThread->state = OS_STATE_RUNNABLE; 19 __osEnqueueAndYield(&__osRunQueue); 20 } 21 } 22 23 __osRestoreInt(int_disabled); 24 }