mirror of
https://github.com/libretro/ppsspp.git
synced 2025-01-26 19:28:52 +00:00
Merge pull request #5062 from unknownbrackets/thread-minor
Properly remove terminated threads from ready queue
This commit is contained in:
commit
5c41dd6f1e
@ -631,6 +631,25 @@ struct ThreadQueueList
|
||||
}
|
||||
}
|
||||
|
||||
// Only for debugging, returns priority level.
|
||||
int contains(const SceUID uid)
|
||||
{
|
||||
for (int i = 0; i < NUM_QUEUES; ++i)
|
||||
{
|
||||
if (queues[i].data == NULL)
|
||||
continue;
|
||||
|
||||
Queue *cur = &queues[i];
|
||||
for (int j = cur->first; j < cur->end; ++j)
|
||||
{
|
||||
if (cur->data[j] == uid)
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
inline SceUID pop_first()
|
||||
{
|
||||
Queue *cur = first;
|
||||
@ -2423,11 +2442,12 @@ int sceKernelTerminateThread(SceUID threadID)
|
||||
}
|
||||
|
||||
INFO_LOG(SCEKERNEL, "sceKernelTerminateThread(%i)", threadID);
|
||||
// On terminate, we reset the thread priority. On exit, we don't always (see __KernelResetThread.)
|
||||
t->nt.currentPriority = t->nt.initialPriority;
|
||||
// TODO: Should this reschedule? Seems like not.
|
||||
__KernelStopThread(threadID, SCE_KERNEL_ERROR_THREAD_TERMINATED, "thread terminated");
|
||||
|
||||
// On terminate, we reset the thread priority. On exit, we don't always (see __KernelResetThread.)
|
||||
t->nt.currentPriority = t->nt.initialPriority;
|
||||
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user