blob: 4bb7c9f34d0c1911d2117bebaeab2c2eade0aca2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#include "ultra64.h"
void osDestroyThread(OSThread* t) {
register u32 saveMask = __osDisableInt();
register OSThread* pred;
register OSThread* succ;
if (t == NULL) {
t = __osRunningThread;
} else if (t->state != OS_STATE_STOPPED) {
__osDequeueThread(t->queue, t);
}
if (__osActiveQueue == t) {
__osActiveQueue = __osActiveQueue->tlnext;
} else {
pred = __osActiveQueue;
while (pred->priority != -1) {
succ = pred->tlnext;
if (succ == t) {
pred->tlnext = t->tlnext;
break;
}
pred = succ;
}
}
if (t == __osRunningThread) {
__osDispatchThread();
}
__osRestoreInt(saveMask);
}
|