kernel: KScopedSchedulerLockAndSleep: Remove unused ctor.

This commit is contained in:
bunnei 2020-12-03 22:44:06 -08:00
parent b9b7e4f915
commit bc59ca92b6

View File

@ -8,6 +8,7 @@
#pragma once #pragma once
#include "common/common_types.h" #include "common/common_types.h"
#include "core/hle/kernel/handle_table.h"
#include "core/hle/kernel/kernel.h" #include "core/hle/kernel/kernel.h"
#include "core/hle/kernel/thread.h" #include "core/hle/kernel/thread.h"
#include "core/hle/kernel/time_manager.h" #include "core/hle/kernel/time_manager.h"
@ -17,20 +18,16 @@ namespace Kernel {
class KScopedSchedulerLockAndSleep { class KScopedSchedulerLockAndSleep {
private: private:
KernelCore& kernel; KernelCore& kernel;
s64 timeout_tick{}; Handle& event_handle;
Thread* thread{}; Thread* thread{};
Handle* event_handle{}; s64 timeout_tick{};
public: public:
explicit KScopedSchedulerLockAndSleep(KernelCore& kernel, Thread* t, s64 timeout)
: kernel(kernel), timeout_tick(timeout), thread(t) {
/* Lock the scheduler. */
kernel.GlobalSchedulerContext().scheduler_lock.Lock();
}
explicit KScopedSchedulerLockAndSleep(KernelCore& kernel, Handle& event_handle, Thread* t, explicit KScopedSchedulerLockAndSleep(KernelCore& kernel, Handle& event_handle, Thread* t,
s64 timeout) s64 timeout)
: kernel(kernel), event_handle(&event_handle), timeout_tick(timeout), thread(t) { : kernel(kernel), event_handle(event_handle), thread(t), timeout_tick(timeout) {
event_handle = InvalidHandle;
/* Lock the scheduler. */ /* Lock the scheduler. */
kernel.GlobalSchedulerContext().scheduler_lock.Lock(); kernel.GlobalSchedulerContext().scheduler_lock.Lock();
} }
@ -38,10 +35,7 @@ public:
~KScopedSchedulerLockAndSleep() { ~KScopedSchedulerLockAndSleep() {
/* Register the sleep. */ /* Register the sleep. */
if (this->timeout_tick > 0) { if (this->timeout_tick > 0) {
auto& time_manager = kernel.TimeManager(); kernel.TimeManager().ScheduleTimeEvent(event_handle, this->thread, this->timeout_tick);
Handle handle{};
time_manager.ScheduleTimeEvent(event_handle ? *event_handle : handle, this->thread,
this->timeout_tick);
} }
/* Unlock the scheduler. */ /* Unlock the scheduler. */