diff --git a/docs/timers/intrusive-timers/intrusive-timer.md b/docs/timers/intrusive-timers/intrusive-timer.md index e778c678..d5efdf8a 100644 --- a/docs/timers/intrusive-timers/intrusive-timer.md +++ b/docs/timers/intrusive-timers/intrusive-timer.md @@ -26,63 +26,45 @@ The `etl::intrusive_timer` is a replacement for all legacy timers within the ETL - **Dynamic Scheduling** Features a configurable notification hook that fires whenever the next due timer changes, yielding the precise 'time-to-next' interval to user code. -## timer_lock_policy +## etl::timer::lock_policy ```cpp -class timer_lock_policy +class lock_policy ``` **Description** Interface for a timer lock policy. Derive from this to implement your own lock policy. -Declares the following pure virtual functions. +See [lock_policy]({{< relref "timer-lock-policy.md#lock_policy" >}}) ---- - -`virtual void lock() ETL_NOEXCEPT` -Locks access. - ---- - -`virtual void unlock() ETL_NOEXCEPT` -Unlocks access. - ---- - -`virtual bool is_locked() ETL_NOEXCEPT` -Returns `true` if access is locked. - -## timer_no_lock_policy +## etl::timer::no_lock_policy ```cpp -class timer_no_lock_policy : public timer_lock_policy +class no_lock_policy : public timer_lock_policy ``` **Description** A predefined lock policy does no locking. Useful for single threaded code or testing purposes. -## timer_atomic_lock_policy +See [no_lock_policy]({{< relref "timer-lock-policy.md#no_lock_policy" >}}) + +## etl::timer::atomic_lock_policy ```cpp -class timer_atomic_lock_policy : public timer_lock_policy +class atomic_lock_policy : public timer_lock_policy ``` **Description** A predefined lock policy that uses an atomic flag. Only defined if `ETL_HAS_ATOMIC` is `1`. -## timer_time_to_next_notification +See [atomic_lock_policy]({{< relref "timer-lock-policy.md#atomic_lock_policy" >}}) + +## etl::timer::time_to_next_notification ```cpp -timer_time_to_next_notification +time_to_next_notification ``` **Description** This is the base class for 'time to next' notifications. Derive from this to define a custom implementation. ---- - -```cpp -virtual void invoke(etl::timer::interval::type delta) -``` -**Description** -Called to notify user code of the 'time to next' delta for the next due timer. -If not overridden, then does nothing. +See [timer_notification]({{< relref "timer-notification.md" >}}) ## intrusive_timer ```cpp diff --git a/docs/timers/intrusive-timers/timer_lock-policy.md b/docs/timers/intrusive-timers/timer-lock-policy.md similarity index 100% rename from docs/timers/intrusive-timers/timer_lock-policy.md rename to docs/timers/intrusive-timers/timer-lock-policy.md diff --git a/docs/timers/intrusive-timers/timer-notification.md b/docs/timers/intrusive-timers/timer-notification.md index 178a1b5c..ab8b25b2 100644 --- a/docs/timers/intrusive-timers/timer-notification.md +++ b/docs/timers/intrusive-timers/timer-notification.md @@ -10,17 +10,15 @@ weight: 104 From: `C++03` {{< /callout >}} -## Description - ## time_to_next_notification ```cpp -timer_time_to_next_notification +time_to_next_notification ``` **Description** This is the base class for 'time to next' notifications. Derive from this to define a custom implementation. ```cpp -virtual void invoke(etl::timer::interval::type) +virtual void on_time_to_next_notification(etl::timer::interval::type) ``` -If not overridden then does nothing. \ No newline at end of file +If not overridden then does nothing. diff --git a/include/etl/intrusive_timer.h b/include/etl/intrusive_timer.h index 86d51ec8..6f7275f3 100644 --- a/include/etl/intrusive_timer.h +++ b/include/etl/intrusive_timer.h @@ -60,7 +60,7 @@ namespace etl , register_list() , active_list() , expired_list() - , active_notify_time_to_next(&default_notify_time_to_next) + , notify_time_to_next(&default_notify_time_to_next) , enabled(false) , timer_count(0U) { @@ -433,7 +433,7 @@ namespace etl //******************************************* void set_next_timer_notification(etl::timer::time_to_next_notification& notification) ETL_NOEXCEPT { - active_notify_time_to_next = ¬ification; + notify_time_to_next = ¬ification; } //******************************************* @@ -441,7 +441,7 @@ namespace etl //******************************************* void clear_next_timer_notification() ETL_NOEXCEPT { - active_notify_time_to_next = &default_notify_time_to_next; + notify_time_to_next = &default_notify_time_to_next; } //******************************************* @@ -473,7 +473,7 @@ namespace etl if (notify_) { // The next timer has changed, so notify the user. - active_notify_time_to_next->invoke(timer_->get_delta()); + notify_time_to_next->on_time_to_next_notification(timer_->get_delta()); } } @@ -530,7 +530,7 @@ namespace etl etl::private_timer::expired_list expired_list; etl::timer::time_to_next_notification default_notify_time_to_next; - etl::timer::time_to_next_notification* active_notify_time_to_next; + etl::timer::time_to_next_notification* notify_time_to_next; bool enabled; size_t timer_count; diff --git a/include/etl/timer_notification.h b/include/etl/timer_notification.h index ad9f4f20..98c4367b 100644 --- a/include/etl/timer_notification.h +++ b/include/etl/timer_notification.h @@ -47,7 +47,7 @@ namespace etl { public: - virtual void invoke(etl::timer::interval::type) + virtual void on_time_to_next_notification(etl::timer::interval::type) { // Do nothing by default. } diff --git a/test/test_intrusive_timer.cpp b/test/test_intrusive_timer.cpp index 55227fcf..bdb0414a 100644 --- a/test/test_intrusive_timer.cpp +++ b/test/test_intrusive_timer.cpp @@ -222,7 +222,7 @@ namespace { public: - void invoke(uint32_t delta) override + void on_time_to_next_notification(uint32_t delta) override { time_to_next.push_back(delta); }