blob: 6e24b5d83f11ee451c78c10740bdf6ab0f01fdd4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#include "ultra64.h"
void osStopThread(OSThread* thread) {
register u32 prevInt = __osDisableInt();
register u16 state = (thread == NULL) ? OS_STATE_RUNNING : thread->state;
switch (state) {
case OS_STATE_RUNNING:
__osRunningThread->state = OS_STATE_STOPPED;
__osEnqueueAndYield(NULL);
break;
case OS_STATE_RUNNABLE:
case OS_STATE_WAITING:
thread->state = OS_STATE_STOPPED;
__osDequeueThread(thread->queue, thread);
break;
}
__osRestoreInt(prevInt);
}
|