summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/timer.h
diff options
context:
space:
mode:
authorGravatar Yuri Kunde Schlesner2015-01-23 02:19:33 -0200
committerGravatar Yuri Kunde Schlesner2015-01-30 11:47:07 -0200
commitad80ff1e322430634e04ffcb39ffef268411ea6b (patch)
treed9f7c1db67286a11812ffcc1e26f1abb5c02a033 /src/core/hle/kernel/timer.h
parentKernel: Convert Mutex to not use Handles (diff)
downloadyuzu-ad80ff1e322430634e04ffcb39ffef268411ea6b.tar.gz
yuzu-ad80ff1e322430634e04ffcb39ffef268411ea6b.tar.xz
yuzu-ad80ff1e322430634e04ffcb39ffef268411ea6b.zip
Kernel: Convert Timer to (mostly) not use Handles
Diffstat (limited to 'src/core/hle/kernel/timer.h')
-rw-r--r--src/core/hle/kernel/timer.h69
1 files changed, 41 insertions, 28 deletions
diff --git a/src/core/hle/kernel/timer.h b/src/core/hle/kernel/timer.h
index 8170e82d4..24552b4b9 100644
--- a/src/core/hle/kernel/timer.h
+++ b/src/core/hle/kernel/timer.h
@@ -11,37 +11,50 @@
11 11
12namespace Kernel { 12namespace Kernel {
13 13
14/** 14class Timer : public WaitObject {
15 * Cancels a timer 15public:
16 * @param handle Handle of the timer to cancel 16 /**
17 */ 17 * Creates a timer
18ResultCode CancelTimer(Handle handle); 18 * @param reset_type ResetType describing how to create the timer
19 19 * @param name Optional name of timer
20/** 20 * @return The created Timer
21 * Starts a timer with the specified initial delay and interval 21 */
22 * @param handle Handle of the timer to start 22 static ResultVal<SharedPtr<Timer>> Create(ResetType reset_type, std::string name = "Unknown");
23 * @param initial Delay until the timer is first fired 23
24 * @param interval Delay until the timer is fired after the first time 24 std::string GetTypeName() const override { return "Timer"; }
25 */ 25 std::string GetName() const override { return name; }
26ResultCode SetTimer(Handle handle, s64 initial, s64 interval); 26
27 27 static const HandleType HANDLE_TYPE = HandleType::Timer;
28/** 28 HandleType GetHandleType() const override { return HANDLE_TYPE; }
29 * Clears a timer 29
30 * @param handle Handle of the timer to clear 30 ResetType reset_type; ///< The ResetType of this timer
31 */ 31
32ResultCode ClearTimer(Handle handle); 32 bool signaled; ///< Whether the timer has been signaled or not
33 33 std::string name; ///< Name of timer (optional)
34/** 34
35 * Creates a timer 35 u64 initial_delay; ///< The delay until the timer fires for the first time
36 * @param handle Handle to the newly created Timer object 36 u64 interval_delay; ///< The delay until the timer fires after the first time
37 * @param reset_type ResetType describing how to create the timer 37
38 * @param name Optional name of timer 38 bool ShouldWait() override;
39 * @return ResultCode of the error 39 void Acquire() override;
40 */ 40
41ResultCode CreateTimer(Handle* handle, const ResetType reset_type, const std::string& name="Unknown"); 41 /**
42 * Starts the timer, with the specified initial delay and interval.
43 * @param initial Delay until the timer is first fired
44 * @param interval Delay until the timer is fired after the first time
45 */
46 void Set(s64 initial, s64 interval);
47
48 void Cancel();
49 void Clear();
50
51private:
52 Timer() = default;
53};
42 54
43/// Initializes the required variables for timers 55/// Initializes the required variables for timers
44void TimersInit(); 56void TimersInit();
45/// Tears down the timer variables 57/// Tears down the timer variables
46void TimersShutdown(); 58void TimersShutdown();
59
47} // namespace 60} // namespace