diff options
author | bunnei <bunneidev@gmail.com> | 2015-01-14 19:22:50 -0500 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2015-01-21 18:41:00 -0500 |
commit | c22bac6398ff1705992fc44b2c29775c84cff662 (patch) | |
tree | e20da7e6e1824c19b7ced73f43815397749ffae7 /src/core/hle/kernel/timer.cpp | |
parent | 0c7498545f7f9beeb7e8070e1a1955a8d6f40bb6 (diff) |
Kernel: Added WaitObject and changed "waitable" objects inherit from it.
Diffstat (limited to 'src/core/hle/kernel/timer.cpp')
-rw-r--r-- | src/core/hle/kernel/timer.cpp | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/core/hle/kernel/timer.cpp b/src/core/hle/kernel/timer.cpp index 3b0452d4d9..2d4fa4c011 100644 --- a/src/core/hle/kernel/timer.cpp +++ b/src/core/hle/kernel/timer.cpp @@ -13,7 +13,7 @@ namespace Kernel { -class Timer : public Object { +class Timer : public WaitObject { public: std::string GetTypeName() const override { return "Timer"; } std::string GetName() const override { return name; } @@ -24,7 +24,6 @@ public: ResetType reset_type; ///< The ResetType of this timer bool signaled; ///< Whether the timer has been signaled or not - std::set<Handle> waiting_threads; ///< Threads that are waiting for the timer std::string name; ///< Name of timer (optional) u64 initial_delay; ///< The delay until the timer fires for the first time @@ -33,7 +32,7 @@ public: ResultVal<bool> WaitSynchronization() override { bool wait = !signaled; if (wait) { - waiting_threads.insert(GetCurrentThread()->GetHandle()); + AddWaitingThread(GetCurrentThread()); Kernel::WaitCurrentThread(WAITTYPE_TIMER, this); } return MakeResult<bool>(wait); @@ -92,12 +91,7 @@ static void TimerCallback(u64 timer_handle, int cycles_late) { timer->signaled = true; // Resume all waiting threads - for (Handle thread_handle : timer->waiting_threads) { - if (SharedPtr<Thread> thread = Kernel::g_handle_table.Get<Thread>(thread_handle)) - thread->ResumeFromWait(); - } - - timer->waiting_threads.clear(); + timer->ResumeAllWaitingThreads(); if (timer->reset_type == RESETTYPE_ONESHOT) timer->signaled = false; |