diff options
author | Zach Hilman <zachhilman@gmail.com> | 2018-11-19 05:44:19 +0100 |
---|---|---|
committer | Zach Hilman <zachhilman@gmail.com> | 2018-11-19 05:44:19 +0100 |
commit | 409dcf0e0aecfdb676fd3b64223a25e47c1b1c1a (patch) | |
tree | ccb9eae7c7e8b93760f3087fb6e67a13cbb24f2c /src/core/hle/kernel/scheduler.cpp | |
parent | Merge pull request #1717 from FreddyFunk/swizzle-gob (diff) | |
download | yuzu-409dcf0e0aecfdb676fd3b64223a25e47c1b1c1a.tar yuzu-409dcf0e0aecfdb676fd3b64223a25e47c1b1c1a.tar.gz yuzu-409dcf0e0aecfdb676fd3b64223a25e47c1b1c1a.tar.bz2 yuzu-409dcf0e0aecfdb676fd3b64223a25e47c1b1c1a.tar.lz yuzu-409dcf0e0aecfdb676fd3b64223a25e47c1b1c1a.tar.xz yuzu-409dcf0e0aecfdb676fd3b64223a25e47c1b1c1a.tar.zst yuzu-409dcf0e0aecfdb676fd3b64223a25e47c1b1c1a.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/kernel/scheduler.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/core/hle/kernel/scheduler.cpp b/src/core/hle/kernel/scheduler.cpp index 5a5f4cef1..fb5e14950 100644 --- a/src/core/hle/kernel/scheduler.cpp +++ b/src/core/hle/kernel/scheduler.cpp @@ -169,6 +169,16 @@ void Scheduler::UnscheduleThread(Thread* thread, u32 priority) { ready_queue.remove(priority, thread); } +void Scheduler::RescheduleThread(Thread* thread, u32 priority) { + std::lock_guard<std::mutex> lock(scheduler_mutex); + + // Thread is not in queue + ASSERT(ready_queue.contains(thread) != -1); + + ready_queue.remove(priority, thread); + ready_queue.push_back(priority, thread); +} + void Scheduler::SetThreadPriority(Thread* thread, u32 priority) { std::lock_guard<std::mutex> lock(scheduler_mutex); @@ -179,4 +189,12 @@ void Scheduler::SetThreadPriority(Thread* thread, u32 priority) { ready_queue.prepare(priority); } +Thread* Scheduler::GetNextSuggestedThread(u32 core) { + std::lock_guard<std::mutex> lock(scheduler_mutex); + + const auto mask = 1 << core; + return ready_queue.get_first_filter( + [&mask](Thread* thread) { return (thread->GetAffinityMask() & mask) != 0; }); +} + } // namespace Kernel |