early-access version 3694
This commit is contained in:
parent
cde14e143c
commit
df898bc7d9
@ -1,7 +1,7 @@
|
|||||||
yuzu emulator early access
|
yuzu emulator early access
|
||||||
=============
|
=============
|
||||||
|
|
||||||
This is the source code for early-access 3692.
|
This is the source code for early-access 3694.
|
||||||
|
|
||||||
## Legal Notice
|
## Legal Notice
|
||||||
|
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <cinttypes>
|
#include <cinttypes>
|
||||||
|
#include <condition_variable>
|
||||||
|
#include <mutex>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@ -1311,7 +1313,8 @@ void KThread::RequestDummyThreadWait() {
|
|||||||
ASSERT(this->IsDummyThread());
|
ASSERT(this->IsDummyThread());
|
||||||
|
|
||||||
// We will block when the scheduler lock is released.
|
// We will block when the scheduler lock is released.
|
||||||
m_dummy_thread_runnable.store(false);
|
std::scoped_lock lock{m_dummy_thread_mutex};
|
||||||
|
m_dummy_thread_runnable = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void KThread::DummyThreadBeginWait() {
|
void KThread::DummyThreadBeginWait() {
|
||||||
@ -1321,7 +1324,8 @@ void KThread::DummyThreadBeginWait() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Block until runnable is no longer false.
|
// Block until runnable is no longer false.
|
||||||
m_dummy_thread_runnable.wait(false);
|
std::unique_lock lock{m_dummy_thread_mutex};
|
||||||
|
m_dummy_thread_cv.wait(lock, [this] { return m_dummy_thread_runnable; });
|
||||||
}
|
}
|
||||||
|
|
||||||
void KThread::DummyThreadEndWait() {
|
void KThread::DummyThreadEndWait() {
|
||||||
@ -1329,8 +1333,11 @@ void KThread::DummyThreadEndWait() {
|
|||||||
ASSERT(this->IsDummyThread());
|
ASSERT(this->IsDummyThread());
|
||||||
|
|
||||||
// Wake up the waiting thread.
|
// Wake up the waiting thread.
|
||||||
m_dummy_thread_runnable.store(true);
|
{
|
||||||
m_dummy_thread_runnable.notify_one();
|
std::scoped_lock lock{m_dummy_thread_mutex};
|
||||||
|
m_dummy_thread_runnable = true;
|
||||||
|
}
|
||||||
|
m_dummy_thread_cv.notify_one();
|
||||||
}
|
}
|
||||||
|
|
||||||
void KThread::BeginWait(KThreadQueue* queue) {
|
void KThread::BeginWait(KThreadQueue* queue) {
|
||||||
|
@ -893,7 +893,9 @@ private:
|
|||||||
std::shared_ptr<Common::Fiber> m_host_context{};
|
std::shared_ptr<Common::Fiber> m_host_context{};
|
||||||
ThreadType m_thread_type{};
|
ThreadType m_thread_type{};
|
||||||
StepState m_step_state{};
|
StepState m_step_state{};
|
||||||
std::atomic<bool> m_dummy_thread_runnable{true};
|
bool m_dummy_thread_runnable{true};
|
||||||
|
std::mutex m_dummy_thread_mutex{};
|
||||||
|
std::condition_variable m_dummy_thread_cv{};
|
||||||
|
|
||||||
// For debugging
|
// For debugging
|
||||||
std::vector<KSynchronizationObject*> m_wait_objects_for_debugging{};
|
std::vector<KSynchronizationObject*> m_wait_objects_for_debugging{};
|
||||||
|
Loading…
Reference in New Issue
Block a user