forked from etc/pineapple-src
early-access version 3100
This commit is contained in:
parent
8a4859cdb0
commit
842c60bef9
3 changed files with 10 additions and 4 deletions
|
@ -1,7 +1,7 @@
|
||||||
yuzu emulator early access
|
yuzu emulator early access
|
||||||
=============
|
=============
|
||||||
|
|
||||||
This is the source code for early-access 3099.
|
This is the source code for early-access 3100.
|
||||||
|
|
||||||
## Legal Notice
|
## Legal Notice
|
||||||
|
|
||||||
|
|
|
@ -384,7 +384,8 @@ void KScheduler::SwitchThread(KThread* next_thread) {
|
||||||
|
|
||||||
void KScheduler::ScheduleImpl() {
|
void KScheduler::ScheduleImpl() {
|
||||||
// First, clear the needs scheduling bool.
|
// First, clear the needs scheduling bool.
|
||||||
m_state.needs_scheduling.store(false, std::memory_order_seq_cst);
|
m_state.needs_scheduling.store(false, std::memory_order_relaxed);
|
||||||
|
std::atomic_thread_fence(std::memory_order_seq_cst);
|
||||||
|
|
||||||
// Load the appropriate thread pointers for scheduling.
|
// Load the appropriate thread pointers for scheduling.
|
||||||
KThread* const cur_thread{GetCurrentThreadPointer(kernel)};
|
KThread* const cur_thread{GetCurrentThreadPointer(kernel)};
|
||||||
|
@ -400,7 +401,8 @@ void KScheduler::ScheduleImpl() {
|
||||||
// If there aren't, we want to check if the highest priority thread is the same as the current
|
// If there aren't, we want to check if the highest priority thread is the same as the current
|
||||||
// thread.
|
// thread.
|
||||||
if (highest_priority_thread == cur_thread) {
|
if (highest_priority_thread == cur_thread) {
|
||||||
// If they're the same, then we can just return.
|
// If they're the same, then we can just issue a memory barrier and return.
|
||||||
|
std::atomic_thread_fence(std::memory_order_seq_cst);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -476,7 +478,8 @@ void KScheduler::ScheduleImplFiber() {
|
||||||
|
|
||||||
// We failed to successfully do the context switch, and need to retry.
|
// We failed to successfully do the context switch, and need to retry.
|
||||||
// Clear needs_scheduling.
|
// Clear needs_scheduling.
|
||||||
m_state.needs_scheduling.store(false, std::memory_order_seq_cst);
|
m_state.needs_scheduling.store(false, std::memory_order_relaxed);
|
||||||
|
std::atomic_thread_fence(std::memory_order_seq_cst);
|
||||||
|
|
||||||
// Refresh the highest priority thread.
|
// Refresh the highest priority thread.
|
||||||
highest_priority_thread = m_state.highest_priority_thread;
|
highest_priority_thread = m_state.highest_priority_thread;
|
||||||
|
|
|
@ -60,6 +60,9 @@ public:
|
||||||
|
|
||||||
// Release an instance of the lock.
|
// Release an instance of the lock.
|
||||||
if ((--lock_count) == 0) {
|
if ((--lock_count) == 0) {
|
||||||
|
// Perform a memory barrier here.
|
||||||
|
std::atomic_thread_fence(std::memory_order_seq_cst);
|
||||||
|
|
||||||
// We're no longer going to hold the lock. Take note of what cores need scheduling.
|
// We're no longer going to hold the lock. Take note of what cores need scheduling.
|
||||||
const u64 cores_needing_scheduling =
|
const u64 cores_needing_scheduling =
|
||||||
SchedulerType::UpdateHighestPriorityThreads(kernel);
|
SchedulerType::UpdateHighestPriorityThreads(kernel);
|
||||||
|
|
Loading…
Reference in a new issue