diff options
Diffstat (limited to 'src/components/utils/include/utils/timer.h')
-rw-r--r-- | src/components/utils/include/utils/timer.h | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/components/utils/include/utils/timer.h b/src/components/utils/include/utils/timer.h index e391db992c..b012b97e6a 100644 --- a/src/components/utils/include/utils/timer.h +++ b/src/components/utils/include/utils/timer.h @@ -102,6 +102,8 @@ class Timer { */ bool is_running() const; + bool is_completed() const; + /** * @brief Gets current timer timeout * @return Current timeout in milliseconds. @@ -119,7 +121,7 @@ class Timer { * @brief Constructor * @param timer Timer instance pointer for callback calling */ - TimerDelegate(const Timer* timer, sync_primitives::Lock& state_lock_ref); + TimerDelegate(Timer* timer, sync_primitives::Lock& state_lock_ref); /** * @brief Sets timer timeout @@ -161,7 +163,7 @@ class Timer { void exitThreadMain() OVERRIDE; private: - const Timer* timer_; + Timer* timer_; Milliseconds timeout_; /** @@ -187,13 +189,13 @@ class Timer { * Not thread-safe * @param timeout Timer timeout */ - void StartDelegate(const Milliseconds timeout) const; + void StartDelegate(const Milliseconds timeout); /** * @brief Sets up timer delegate to stop state. * Not thread-safe */ - void StopDelegate() const; + void StopDelegate(); /** * @brief Starts timer thread. @@ -211,14 +213,14 @@ class Timer { * @brief Callback called on timeout. * Not thread-safe */ - void OnTimeout() const; + void OnTimeout(); const std::string name_; TimerTask* task_; mutable sync_primitives::Lock state_lock_; - mutable std::unique_ptr<TimerDelegate> delegate_; + std::unique_ptr<TimerDelegate> delegate_; threads::Thread* thread_; /** @@ -226,6 +228,8 @@ class Timer { */ bool single_shot_; + bool completed_flag_; + DISALLOW_COPY_AND_ASSIGN(Timer); }; |