|
|
@ -15,13 +15,14 @@
|
|
|
|
#include "common/logging/log.h"
|
|
|
|
#include "common/logging/log.h"
|
|
|
|
#include "core/core.h"
|
|
|
|
#include "core/core.h"
|
|
|
|
#include "core/hle/ipc_helpers.h"
|
|
|
|
#include "core/hle/ipc_helpers.h"
|
|
|
|
#include "core/hle/kernel/event.h"
|
|
|
|
|
|
|
|
#include "core/hle/kernel/handle_table.h"
|
|
|
|
#include "core/hle/kernel/handle_table.h"
|
|
|
|
#include "core/hle/kernel/hle_ipc.h"
|
|
|
|
#include "core/hle/kernel/hle_ipc.h"
|
|
|
|
#include "core/hle/kernel/kernel.h"
|
|
|
|
#include "core/hle/kernel/kernel.h"
|
|
|
|
#include "core/hle/kernel/object.h"
|
|
|
|
#include "core/hle/kernel/object.h"
|
|
|
|
#include "core/hle/kernel/process.h"
|
|
|
|
#include "core/hle/kernel/process.h"
|
|
|
|
|
|
|
|
#include "core/hle/kernel/readable_event.h"
|
|
|
|
#include "core/hle/kernel/server_session.h"
|
|
|
|
#include "core/hle/kernel/server_session.h"
|
|
|
|
|
|
|
|
#include "core/hle/kernel/writable_event.h"
|
|
|
|
#include "core/memory.h"
|
|
|
|
#include "core/memory.h"
|
|
|
|
|
|
|
|
|
|
|
|
namespace Kernel {
|
|
|
|
namespace Kernel {
|
|
|
@ -36,11 +37,9 @@ void SessionRequestHandler::ClientDisconnected(const SharedPtr<ServerSession>& s
|
|
|
|
boost::range::remove_erase(connected_sessions, server_session);
|
|
|
|
boost::range::remove_erase(connected_sessions, server_session);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SharedPtr<Event> HLERequestContext::SleepClientThread(SharedPtr<Thread> thread,
|
|
|
|
SharedPtr<WritableEvent> HLERequestContext::SleepClientThread(
|
|
|
|
const std::string& reason, u64 timeout,
|
|
|
|
SharedPtr<Thread> thread, const std::string& reason, u64 timeout, WakeupCallback&& callback,
|
|
|
|
WakeupCallback&& callback,
|
|
|
|
SharedPtr<WritableEvent> writable_event, SharedPtr<ReadableEvent> readable_event) {
|
|
|
|
Kernel::SharedPtr<Kernel::Event> event) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Put the client thread to sleep until the wait event is signaled or the timeout expires.
|
|
|
|
// Put the client thread to sleep until the wait event is signaled or the timeout expires.
|
|
|
|
thread->SetWakeupCallback([context = *this, callback](
|
|
|
|
thread->SetWakeupCallback([context = *this, callback](
|
|
|
|
ThreadWakeupReason reason, SharedPtr<Thread> thread,
|
|
|
|
ThreadWakeupReason reason, SharedPtr<Thread> thread,
|
|
|
@ -51,23 +50,23 @@ SharedPtr<Event> HLERequestContext::SleepClientThread(SharedPtr<Thread> thread,
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
if (!event) {
|
|
|
|
auto& kernel = Core::System::GetInstance().Kernel();
|
|
|
|
|
|
|
|
if (!writable_event || !readable_event) {
|
|
|
|
// Create event if not provided
|
|
|
|
// Create event if not provided
|
|
|
|
auto& kernel = Core::System::GetInstance().Kernel();
|
|
|
|
std::tie(writable_event, readable_event) = WritableEvent::CreateEventPair(
|
|
|
|
event =
|
|
|
|
kernel, Kernel::ResetType::OneShot, "HLE Pause Event: " + reason);
|
|
|
|
Kernel::Event::Create(kernel, Kernel::ResetType::OneShot, "HLE Pause Event: " + reason);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
event->Clear();
|
|
|
|
writable_event->Clear();
|
|
|
|
thread->SetStatus(ThreadStatus::WaitHLEEvent);
|
|
|
|
thread->SetStatus(ThreadStatus::WaitHLEEvent);
|
|
|
|
thread->SetWaitObjects({event});
|
|
|
|
thread->SetWaitObjects({readable_event});
|
|
|
|
event->AddWaitingThread(thread);
|
|
|
|
readable_event->AddWaitingThread(thread);
|
|
|
|
|
|
|
|
|
|
|
|
if (timeout > 0) {
|
|
|
|
if (timeout > 0) {
|
|
|
|
thread->WakeAfterDelay(timeout);
|
|
|
|
thread->WakeAfterDelay(timeout);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return event;
|
|
|
|
return writable_event;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
HLERequestContext::HLERequestContext(SharedPtr<Kernel::ServerSession> server_session)
|
|
|
|
HLERequestContext::HLERequestContext(SharedPtr<Kernel::ServerSession> server_session)
|
|
|
|