diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2020-03-07 15:24:46 +0100 |
---|---|---|
committer | Fernando Sahmkow <fsahmkow27@gmail.com> | 2020-06-27 17:35:33 +0200 |
commit | a66c61ca2de61e3a46fa857cf8afea359b2fb8eb (patch) | |
tree | 7ed933638efc1a292fd452fbb2935042be7ec5e3 /src | |
parent | Scheduler: Correct locking for hle threads. (diff) | |
download | yuzu-a66c61ca2de61e3a46fa857cf8afea359b2fb8eb.tar yuzu-a66c61ca2de61e3a46fa857cf8afea359b2fb8eb.tar.gz yuzu-a66c61ca2de61e3a46fa857cf8afea359b2fb8eb.tar.bz2 yuzu-a66c61ca2de61e3a46fa857cf8afea359b2fb8eb.tar.lz yuzu-a66c61ca2de61e3a46fa857cf8afea359b2fb8eb.tar.xz yuzu-a66c61ca2de61e3a46fa857cf8afea359b2fb8eb.tar.zst yuzu-a66c61ca2de61e3a46fa857cf8afea359b2fb8eb.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/core/hle/kernel/synchronization.cpp | 2 | ||||
-rw-r--r-- | src/core/hle/kernel/thread.cpp | 5 | ||||
-rw-r--r-- | src/core/hle/kernel/thread.h | 9 |
3 files changed, 14 insertions, 2 deletions
diff --git a/src/core/hle/kernel/synchronization.cpp b/src/core/hle/kernel/synchronization.cpp index ac43a7094..a7e3fbe92 100644 --- a/src/core/hle/kernel/synchronization.cpp +++ b/src/core/hle/kernel/synchronization.cpp @@ -74,7 +74,9 @@ std::pair<ResultCode, Handle> Synchronization::WaitFor( thread->SetSynchronizationObjects(&sync_objects); thread->SetSynchronizationResults(nullptr, RESULT_TIMEOUT); thread->SetStatus(ThreadStatus::WaitSynch); + thread->SetWaitingSync(true); } + thread->SetWaitingSync(false); if (event_handle != InvalidHandle) { auto& time_manager = kernel.TimeManager(); diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index fb1751860..e8962a0d8 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp @@ -139,13 +139,14 @@ ResultCode Thread::Start() { void Thread::CancelWait() { SchedulerLock lock(kernel); - if (GetSchedulingStatus() != ThreadSchedStatus::Paused) { + if (GetSchedulingStatus() != ThreadSchedStatus::Paused || !is_waiting_on_sync) { is_sync_cancelled = true; return; } + //TODO(Blinkhawk): Implement cancel of server session is_sync_cancelled = false; SetSynchronizationResults(nullptr, ERR_SYNCHRONIZATION_CANCELED); - ResumeFromWait(); + SetStatus(ThreadStatus::Ready); } static void ResetThreadContext32(Core::ARM_Interface::ThreadContext32& context, u32 stack_top, diff --git a/src/core/hle/kernel/thread.h b/src/core/hle/kernel/thread.h index e8355bbd1..d8a983200 100644 --- a/src/core/hle/kernel/thread.h +++ b/src/core/hle/kernel/thread.h @@ -556,6 +556,14 @@ public: waiting_for_arbitration = set; } + bool IsWaitingSync() const { + return is_waiting_on_sync; + } + + void SetWaitingSync(bool is_waiting) { + is_waiting_on_sync = is_waiting; + } + private: friend class GlobalScheduler; friend class Scheduler; @@ -650,6 +658,7 @@ private: u32 scheduling_state = 0; bool is_running = false; + bool is_waiting_on_sync = false; bool is_sync_cancelled = false; bool will_be_terminated{}; |