summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/timer.h
diff options
context:
space:
mode:
authorGravatar Lioncash2019-01-31 23:05:00 -0500
committerGravatar Lioncash2019-01-31 23:05:15 -0500
commit414cc1eb1fdbaa0001938711665f47c940bed3c7 (patch)
treec3897dd1193d322b52aba555fcb422badee1520d /src/core/hle/kernel/timer.h
parentMerge pull request #2072 from lioncash/service (diff)
downloadyuzu-414cc1eb1fdbaa0001938711665f47c940bed3c7.tar.gz
yuzu-414cc1eb1fdbaa0001938711665f47c940bed3c7.tar.xz
yuzu-414cc1eb1fdbaa0001938711665f47c940bed3c7.zip
kernel: Remove the Timer class
A holdover from citra, the Horizon kernel on the switch has no prominent kernel object that functions as a timer. At least not to the degree of sophistication that this class provided. As such, this can be removed entirely. This class also wasn't used at all in any meaningful way within the core, so this was just code sitting around doing nothing. This also allows removing a few things from the main KernelCore class that allows it to use slightly less resources overall (though very minor and not anything really noticeable).
Diffstat (limited to 'src/core/hle/kernel/timer.h')
-rw-r--r--src/core/hle/kernel/timer.h88
1 files changed, 0 insertions, 88 deletions
diff --git a/src/core/hle/kernel/timer.h b/src/core/hle/kernel/timer.h
deleted file mode 100644
index ce3e74426..000000000
--- a/src/core/hle/kernel/timer.h
+++ /dev/null
@@ -1,88 +0,0 @@
1// Copyright 2015 Citra Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include "common/common_types.h"
8#include "core/hle/kernel/object.h"
9#include "core/hle/kernel/wait_object.h"
10
11namespace Kernel {
12
13class KernelCore;
14
15class Timer final : public WaitObject {
16public:
17 /**
18 * Creates a timer
19 * @param kernel The kernel instance to create the timer callback handle for.
20 * @param reset_type ResetType describing how to create the timer
21 * @param name Optional name of timer
22 * @return The created Timer
23 */
24 static SharedPtr<Timer> Create(KernelCore& kernel, ResetType reset_type,
25 std::string name = "Unknown");
26
27 std::string GetTypeName() const override {
28 return "Timer";
29 }
30 std::string GetName() const override {
31 return name;
32 }
33
34 static const HandleType HANDLE_TYPE = HandleType::Timer;
35 HandleType GetHandleType() const override {
36 return HANDLE_TYPE;
37 }
38
39 ResetType GetResetType() const {
40 return reset_type;
41 }
42
43 u64 GetInitialDelay() const {
44 return initial_delay;
45 }
46
47 u64 GetIntervalDelay() const {
48 return interval_delay;
49 }
50
51 bool ShouldWait(Thread* thread) const override;
52 void Acquire(Thread* thread) override;
53
54 /**
55 * Starts the timer, with the specified initial delay and interval.
56 * @param initial Delay until the timer is first fired
57 * @param interval Delay until the timer is fired after the first time
58 */
59 void Set(s64 initial, s64 interval);
60
61 void Cancel();
62 void Clear();
63
64 /**
65 * Signals the timer, waking up any waiting threads and rescheduling it
66 * for the next interval.
67 * This method should not be called from outside the timer callback handler,
68 * lest multiple callback events get scheduled.
69 */
70 void Signal(int cycles_late);
71
72private:
73 explicit Timer(KernelCore& kernel);
74 ~Timer() override;
75
76 ResetType reset_type; ///< The ResetType of this timer
77
78 u64 initial_delay; ///< The delay until the timer fires for the first time
79 u64 interval_delay; ///< The delay until the timer fires after the first time
80
81 bool signaled; ///< Whether the timer has been signaled or not
82 std::string name; ///< Name of timer (optional)
83
84 /// Handle used as userdata to reference this object when inserting into the CoreTiming queue.
85 Handle callback_handle;
86};
87
88} // namespace Kernel