From 67c0d714c5b6e93ddb00d0807147b5673c011ac6 Mon Sep 17 00:00:00 2001 From: Liam Date: Sun, 18 Dec 2022 16:37:19 -0500 Subject: kernel: add KHardwareTimer --- src/core/hle/kernel/k_thread.h | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/core/hle/kernel/k_thread.h') diff --git a/src/core/hle/kernel/k_thread.h b/src/core/hle/kernel/k_thread.h index dc52b4ed3..1320451c0 100644 --- a/src/core/hle/kernel/k_thread.h +++ b/src/core/hle/kernel/k_thread.h @@ -22,6 +22,7 @@ #include "core/hle/kernel/k_light_lock.h" #include "core/hle/kernel/k_spin_lock.h" #include "core/hle/kernel/k_synchronization_object.h" +#include "core/hle/kernel/k_timer_task.h" #include "core/hle/kernel/k_worker_task.h" #include "core/hle/kernel/slab_helpers.h" #include "core/hle/kernel/svc_common.h" @@ -112,7 +113,8 @@ void SetCurrentThread(KernelCore& kernel, KThread* thread); [[nodiscard]] s32 GetCurrentCoreId(KernelCore& kernel); class KThread final : public KAutoObjectWithSlabHeapAndContainer, - public boost::intrusive::list_base_hook<> { + public boost::intrusive::list_base_hook<>, + public KTimerTask { KERNEL_AUTOOBJECT_TRAITS(KThread, KSynchronizationObject); private: @@ -660,7 +662,7 @@ private: union SyncObjectBuffer { std::array sync_objects{}; std::array + Svc::ArgumentHandleCountMax * (sizeof(KSynchronizationObject*) / sizeof(Handle))> handles; constexpr SyncObjectBuffer() {} }; @@ -681,10 +683,8 @@ private: }; template - requires( - std::same_as || - std::same_as) static constexpr int Compare(const T& lhs, - const KThread& rhs) { + requires(std::same_as || std::same_as) + static constexpr int Compare(const T& lhs, const KThread& rhs) { const u64 l_key = lhs.GetConditionVariableKey(); const u64 r_key = rhs.GetConditionVariableKey(); @@ -840,4 +840,8 @@ private: KernelCore& kernel; }; +inline void KTimerTask::OnTimer() { + static_cast(this)->OnTimer(); +} + } // namespace Kernel -- cgit v1.2.3