aboutsummaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/synchronization.cpp
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2020-02-26 22:26:53 -0400
committerFernando Sahmkow <fsahmkow27@gmail.com>2020-06-27 11:35:17 -0400
commitd4ebb510a05d29befde6556e632413e5b35b9ab5 (patch)
tree309755a4ef21b48f12cca6c40798dccd191cf860 /src/core/hle/kernel/synchronization.cpp
parent5b6a67f849d0d78d6f71ccb7d93f48a97760a901 (diff)
SVC: Correct WaitSynchronization, WaitProcessWideKey, SignalProcessWideKey.
Diffstat (limited to 'src/core/hle/kernel/synchronization.cpp')
-rw-r--r--src/core/hle/kernel/synchronization.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/core/hle/kernel/synchronization.cpp b/src/core/hle/kernel/synchronization.cpp
index b36e550a04..c60c5bb422 100644
--- a/src/core/hle/kernel/synchronization.cpp
+++ b/src/core/hle/kernel/synchronization.cpp
@@ -17,12 +17,15 @@ namespace Kernel {
Synchronization::Synchronization(Core::System& system) : system{system} {}
void Synchronization::SignalObject(SynchronizationObject& obj) const {
- SchedulerLock lock(system.Kernel());
+ auto& kernel = system.Kernel();
+ SchedulerLock lock(kernel);
+ auto& time_manager = kernel.TimeManager();
if (obj.IsSignaled()) {
for (auto thread : obj.GetWaitingThreads()) {
if (thread->GetSchedulingStatus() == ThreadSchedStatus::Paused) {
thread->SetSynchronizationResults(&obj, RESULT_SUCCESS);
thread->ResumeFromWait();
+ time_manager.CancelTimeEvent(thread.get());
}
}
}
@@ -79,6 +82,9 @@ std::pair<ResultCode, Handle> Synchronization::WaitFor(
SchedulerLock lock(kernel);
ResultCode signaling_result = thread->GetSignalingResult();
SynchronizationObject* signaling_object = thread->GetSignalingObject();
+ for (auto& obj : sync_objects) {
+ obj->RemoveWaitingThread(SharedFrom(thread));
+ }
if (signaling_result == RESULT_SUCCESS) {
const auto itr = std::find_if(
sync_objects.begin(), sync_objects.end(),