mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-16 18:59:18 +01:00
Clear insertThreadOnResume
in RemoveThread
A thread can be paused while it is in a synchronization primitive which will do `RemoveThread`, we need to update the state of `insertThreadOnResume` in this case by clearing it so it isn't incorrectly reinserted on resuming the thread.
This commit is contained in:
parent
7fef849594
commit
3a6f205e6f
@ -257,9 +257,11 @@ namespace skyline::kernel {
|
|||||||
|
|
||||||
void Scheduler::RemoveThread() {
|
void Scheduler::RemoveThread() {
|
||||||
auto &thread{state.thread};
|
auto &thread{state.thread};
|
||||||
auto &core{cores.at(thread->coreId)};
|
|
||||||
{
|
{
|
||||||
|
auto &core{cores.at(thread->coreId)};
|
||||||
std::unique_lock lock(core.mutex);
|
std::unique_lock lock(core.mutex);
|
||||||
|
|
||||||
|
if (!thread->isPaused) {
|
||||||
auto it{std::find(core.queue.begin(), core.queue.end(), thread)};
|
auto it{std::find(core.queue.begin(), core.queue.end(), thread)};
|
||||||
if (it != core.queue.end()) {
|
if (it != core.queue.end()) {
|
||||||
it = core.queue.erase(it);
|
it = core.queue.erase(it);
|
||||||
@ -272,6 +274,9 @@ namespace skyline::kernel {
|
|||||||
(*it)->scheduleCondition.notify_one(); // We need to wake the thread at the front of the queue, if we were at the front previously
|
(*it)->scheduleCondition.notify_one(); // We need to wake the thread at the front of the queue, if we were at the front previously
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
thread->insertThreadOnResume = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
thread->DisarmPreemptionTimer();
|
thread->DisarmPreemptionTimer();
|
||||||
|
Loading…
Reference in New Issue
Block a user