ThreadEvent: Handle getting scheduled off a thread.

This commit is contained in:
Unknown W. Brackets 2016-05-29 00:12:36 -07:00
parent 97cce6ccfe
commit 4fc12cdd29
2 changed files with 4 additions and 4 deletions

View File

@ -99,7 +99,7 @@ struct ThreadQueueList {
return 0;
}
inline SceUID peek_first(u32 priority) {
inline SceUID peek_first() {
Queue *cur = first;
while (cur != invalid()) {
if (cur->size() > 0)

View File

@ -3057,7 +3057,7 @@ static bool __CanExecuteCallbackNow(Thread *thread) {
void __KernelCallAddress(Thread *thread, u32 entryPoint, Action *afterAction, const u32 args[], int numargs, bool reschedAfter, SceUID cbId)
{
if (thread->isStopped()) {
if (!thread || thread->isStopped()) {
WARN_LOG_REPORT(SCEKERNEL, "Running mipscall on dormant thread");
}
@ -3591,8 +3591,8 @@ KernelObject *__KernelThreadEventHandlerObject() {
void __KernelThreadTriggerEvent(const ThreadEventHandlerList &handlers, SceUID threadID, ThreadEventType type) {
Thread *thread = __GetCurrentThread();
if (thread->isStopped()) {
SceUID nextThreadID = threadReadyQueue.peek_first(thread->nt.currentPriority);
if (!thread || thread->isStopped()) {
SceUID nextThreadID = threadReadyQueue.peek_first();
thread = kernelObjects.GetFast<Thread>(nextThreadID);
}