diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2020-03-08 12:51:24 -0400 |
---|---|---|
committer | Fernando Sahmkow <fsahmkow27@gmail.com> | 2020-06-27 11:35:40 -0400 |
commit | 6515c6e8c699584528486341579cf3a8dde3eea4 (patch) | |
tree | 1663248cbd02cc0db108ed18feef5a994e44d63d /src/core/hle/kernel/synchronization.cpp | |
parent | 4217e58a103049675df27f404171f73fa0be8537 (diff) |
Kernel: Fixes, corrections and asserts to scheduler and different svcs.
Diffstat (limited to 'src/core/hle/kernel/synchronization.cpp')
-rw-r--r-- | src/core/hle/kernel/synchronization.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/core/hle/kernel/synchronization.cpp b/src/core/hle/kernel/synchronization.cpp index 4323fc1208..275bf11cc0 100644 --- a/src/core/hle/kernel/synchronization.cpp +++ b/src/core/hle/kernel/synchronization.cpp @@ -23,9 +23,10 @@ void Synchronization::SignalObject(SynchronizationObject& obj) const { if (obj.IsSignaled()) { for (auto thread : obj.GetWaitingThreads()) { if (thread->GetSchedulingStatus() == ThreadSchedStatus::Paused) { + ASSERT(thread->GetStatus() == ThreadStatus::WaitSynch); + ASSERT(thread->IsWaitingSync()); thread->SetSynchronizationResults(&obj, RESULT_SUCCESS); thread->ResumeFromWait(); - time_manager.CancelTimeEvent(thread.get()); } } obj.ClearWaitingThreads(); @@ -91,10 +92,11 @@ std::pair<ResultCode, Handle> Synchronization::WaitFor( ResultCode signaling_result = thread->GetSignalingResult(); SynchronizationObject* signaling_object = thread->GetSignalingObject(); thread->SetSynchronizationObjects(nullptr); + auto shared_thread = SharedFrom(thread); for (auto& obj : sync_objects) { - obj->RemoveWaitingThread(SharedFrom(thread)); + obj->RemoveWaitingThread(shared_thread); } - if (signaling_result == RESULT_SUCCESS) { + if (signaling_object != nullptr) { const auto itr = std::find_if( sync_objects.begin(), sync_objects.end(), [signaling_object](const std::shared_ptr<SynchronizationObject>& object) { @@ -103,7 +105,7 @@ std::pair<ResultCode, Handle> Synchronization::WaitFor( ASSERT(itr != sync_objects.end()); signaling_object->Acquire(thread); const u32 index = static_cast<s32>(std::distance(sync_objects.begin(), itr)); - return {RESULT_SUCCESS, index}; + return {signaling_result, index}; } return {signaling_result, -1}; } |