summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/k_timer_task.h
diff options
context:
space:
mode:
authorLiam <byteslice@airmail.cc>2022-12-18 22:37:19 +0100
committerLiam <byteslice@airmail.cc>2022-12-18 22:37:19 +0100
commit67c0d714c5b6e93ddb00d0807147b5673c011ac6 (patch)
treebd35994725d098c7371506d533390800d3253f3e /src/core/hle/kernel/k_timer_task.h
parentMerge pull request #9470 from german77/silenceIkillYou (diff)
downloadyuzu-67c0d714c5b6e93ddb00d0807147b5673c011ac6.tar
yuzu-67c0d714c5b6e93ddb00d0807147b5673c011ac6.tar.gz
yuzu-67c0d714c5b6e93ddb00d0807147b5673c011ac6.tar.bz2
yuzu-67c0d714c5b6e93ddb00d0807147b5673c011ac6.tar.lz
yuzu-67c0d714c5b6e93ddb00d0807147b5673c011ac6.tar.xz
yuzu-67c0d714c5b6e93ddb00d0807147b5673c011ac6.tar.zst
yuzu-67c0d714c5b6e93ddb00d0807147b5673c011ac6.zip
Diffstat (limited to '')
-rw-r--r--src/core/hle/kernel/k_timer_task.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/core/hle/kernel/k_timer_task.h b/src/core/hle/kernel/k_timer_task.h
new file mode 100644
index 000000000..66f0a5a90
--- /dev/null
+++ b/src/core/hle/kernel/k_timer_task.h
@@ -0,0 +1,40 @@
+// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include "common/intrusive_red_black_tree.h"
+
+namespace Kernel {
+
+class KTimerTask : public Common::IntrusiveRedBlackTreeBaseNode<KTimerTask> {
+public:
+ static constexpr int Compare(const KTimerTask& lhs, const KTimerTask& rhs) {
+ if (lhs.GetTime() < rhs.GetTime()) {
+ return -1;
+ } else {
+ return 1;
+ }
+ }
+
+ constexpr explicit KTimerTask() = default;
+
+ constexpr void SetTime(s64 t) {
+ m_time = t;
+ }
+
+ constexpr s64 GetTime() const {
+ return m_time;
+ }
+
+ // NOTE: This is virtual in Nintendo's kernel. Prior to 13.0.0, KWaitObject was also a
+ // TimerTask; this is no longer the case. Since this is now KThread exclusive, we have
+ // devirtualized (see inline declaration for this inside k_thread.h).
+ void OnTimer();
+
+private:
+ // Absolute time in nanoseconds
+ s64 m_time{};
+};
+
+} // namespace Kernel