mirror of
https://gitlab.com/suyu-emu/suyu.git
synced 2024-03-15 23:15:44 +00:00
HLE_IPC: Correct HLE Event behavior on timeout.
This commit is contained in:
parent
7e2ce2f7f4
commit
19165cd859
|
@ -70,6 +70,7 @@ std::shared_ptr<WritableEvent> HLERequestContext::SleepClientThread(
|
|||
});
|
||||
const auto readable_event{writable_event->GetReadableEvent()};
|
||||
writable_event->Clear();
|
||||
thread->SetHLESyncObject(readable_event.get());
|
||||
thread->SetStatus(ThreadStatus::WaitHLEEvent);
|
||||
thread->SetSynchronizationResults(nullptr, RESULT_TIMEOUT);
|
||||
readable_event->AddWaitingThread(thread);
|
||||
|
|
|
@ -333,14 +333,22 @@ static ResultCode SendSyncRequest(Core::System& system, Handle handle) {
|
|||
thread->SetStatus(ThreadStatus::WaitIPC);
|
||||
session->SendSyncRequest(SharedFrom(thread), system.Memory());
|
||||
}
|
||||
|
||||
if (thread->HasHLECallback()) {
|
||||
Handle event_handle = thread->GetHLETimeEvent();
|
||||
if (event_handle != InvalidHandle) {
|
||||
auto& time_manager = system.Kernel().TimeManager();
|
||||
time_manager.UnscheduleTimeEvent(event_handle);
|
||||
}
|
||||
|
||||
{
|
||||
SchedulerLock lock(system.Kernel());
|
||||
auto* sync_object = thread->GetHLESyncObject();
|
||||
sync_object->RemoveWaitingThread(SharedFrom(thread));
|
||||
|
||||
thread->InvokeHLECallback(SharedFrom(thread));
|
||||
}
|
||||
}
|
||||
|
||||
return thread->GetSignalingResult();
|
||||
}
|
||||
|
|
|
@ -489,10 +489,18 @@ public:
|
|||
hle_time_event = time_event;
|
||||
}
|
||||
|
||||
void SetHLESyncObject(SynchronizationObject* object) {
|
||||
hle_object = object;
|
||||
}
|
||||
|
||||
Handle GetHLETimeEvent() const {
|
||||
return hle_time_event;
|
||||
}
|
||||
|
||||
SynchronizationObject* GetHLESyncObject() const {
|
||||
return hle_object;
|
||||
}
|
||||
|
||||
void InvalidateWakeupCallback() {
|
||||
SetWakeupCallback(nullptr);
|
||||
}
|
||||
|
@ -698,6 +706,7 @@ private:
|
|||
/// Callback for HLE Events
|
||||
HLECallback hle_callback;
|
||||
Handle hle_time_event;
|
||||
SynchronizationObject* hle_object;
|
||||
|
||||
Scheduler* scheduler = nullptr;
|
||||
|
||||
|
|
Loading…
Reference in a new issue