mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Properly remove terminated thread from ready queue.
If we change the priority first, we'll remove from the wrong priority level, oops. Gotta change afterward. Should improve Darkstalkers Chronicle: The Chaos Tower.
This commit is contained in:
parent
f45bddf9b6
commit
1a38f6fa7d
1 changed files with 22 additions and 2 deletions
|
@ -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()
|
inline SceUID pop_first()
|
||||||
{
|
{
|
||||||
Queue *cur = first;
|
Queue *cur = first;
|
||||||
|
@ -2423,11 +2442,12 @@ int sceKernelTerminateThread(SceUID threadID)
|
||||||
}
|
}
|
||||||
|
|
||||||
INFO_LOG(SCEKERNEL, "sceKernelTerminateThread(%i)", 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.
|
// TODO: Should this reschedule? Seems like not.
|
||||||
__KernelStopThread(threadID, SCE_KERNEL_ERROR_THREAD_TERMINATED, "thread terminated");
|
__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;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Reference in a new issue