diff options
| author | 2020-03-07 10:24:46 -0400 | |
|---|---|---|
| committer | 2020-06-27 11:35:33 -0400 | |
| commit | a66c61ca2de61e3a46fa857cf8afea359b2fb8eb (patch) | |
| tree | 7ed933638efc1a292fd452fbb2935042be7ec5e3 /src | |
| parent | Scheduler: Correct locking for hle threads. (diff) | |
| download | yuzu-a66c61ca2de61e3a46fa857cf8afea359b2fb8eb.tar.gz yuzu-a66c61ca2de61e3a46fa857cf8afea359b2fb8eb.tar.xz yuzu-a66c61ca2de61e3a46fa857cf8afea359b2fb8eb.zip | |
SCC: Small corrections to CancelSynchronization
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( | |||
| 74 | thread->SetSynchronizationObjects(&sync_objects); | 74 | thread->SetSynchronizationObjects(&sync_objects); |
| 75 | thread->SetSynchronizationResults(nullptr, RESULT_TIMEOUT); | 75 | thread->SetSynchronizationResults(nullptr, RESULT_TIMEOUT); |
| 76 | thread->SetStatus(ThreadStatus::WaitSynch); | 76 | thread->SetStatus(ThreadStatus::WaitSynch); |
| 77 | thread->SetWaitingSync(true); | ||
| 77 | } | 78 | } |
| 79 | thread->SetWaitingSync(false); | ||
| 78 | 80 | ||
| 79 | if (event_handle != InvalidHandle) { | 81 | if (event_handle != InvalidHandle) { |
| 80 | auto& time_manager = kernel.TimeManager(); | 82 | 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() { | |||
| 139 | 139 | ||
| 140 | void Thread::CancelWait() { | 140 | void Thread::CancelWait() { |
| 141 | SchedulerLock lock(kernel); | 141 | SchedulerLock lock(kernel); |
| 142 | if (GetSchedulingStatus() != ThreadSchedStatus::Paused) { | 142 | if (GetSchedulingStatus() != ThreadSchedStatus::Paused || !is_waiting_on_sync) { |
| 143 | is_sync_cancelled = true; | 143 | is_sync_cancelled = true; |
| 144 | return; | 144 | return; |
| 145 | } | 145 | } |
| 146 | //TODO(Blinkhawk): Implement cancel of server session | ||
| 146 | is_sync_cancelled = false; | 147 | is_sync_cancelled = false; |
| 147 | SetSynchronizationResults(nullptr, ERR_SYNCHRONIZATION_CANCELED); | 148 | SetSynchronizationResults(nullptr, ERR_SYNCHRONIZATION_CANCELED); |
| 148 | ResumeFromWait(); | 149 | SetStatus(ThreadStatus::Ready); |
| 149 | } | 150 | } |
| 150 | 151 | ||
| 151 | static void ResetThreadContext32(Core::ARM_Interface::ThreadContext32& context, u32 stack_top, | 152 | 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: | |||
| 556 | waiting_for_arbitration = set; | 556 | waiting_for_arbitration = set; |
| 557 | } | 557 | } |
| 558 | 558 | ||
| 559 | bool IsWaitingSync() const { | ||
| 560 | return is_waiting_on_sync; | ||
| 561 | } | ||
| 562 | |||
| 563 | void SetWaitingSync(bool is_waiting) { | ||
| 564 | is_waiting_on_sync = is_waiting; | ||
| 565 | } | ||
| 566 | |||
| 559 | private: | 567 | private: |
| 560 | friend class GlobalScheduler; | 568 | friend class GlobalScheduler; |
| 561 | friend class Scheduler; | 569 | friend class Scheduler; |
| @@ -650,6 +658,7 @@ private: | |||
| 650 | 658 | ||
| 651 | u32 scheduling_state = 0; | 659 | u32 scheduling_state = 0; |
| 652 | bool is_running = false; | 660 | bool is_running = false; |
| 661 | bool is_waiting_on_sync = false; | ||
| 653 | bool is_sync_cancelled = false; | 662 | bool is_sync_cancelled = false; |
| 654 | 663 | ||
| 655 | bool will_be_terminated{}; | 664 | bool will_be_terminated{}; |