You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Многофункциональный класс. Подходит для следующих задач:
102
102
103
103
* Измерение прошедшего времени, например задержки на выполнение участка кода.
104
-
* Измерение среднего прошедшего времени, например задержки на выполнение участка кода.
104
+
* Измерение среднего прошедшего времени
105
105
* Асинхронный вызов callback-функции с заданным периодом
106
106
* Асинхронный вызов callback-функции с изменяемым периодом
107
+
* Асинхронный вызов callback-функции через заданное время в случае отсутствия обнуления счетчика
108
+
109
+
У таймера есть три режима:
110
+
111
+
```cpp
112
+
enumclassTimerMode {
113
+
STRICT_INTERVAL, /**< First timer mode, where the timer calls the callback at fixed intervals by resetting its internal counter before the callback is called. */
114
+
UNSTABLE_INTERVAL, /**< Second timer mode, where the timer resets its counter after the callback is called, making the period between callbacks unstable. */
115
+
ONE_SHOT_AFTER_INTERVAL, /**< Third timer mode, where the timer calls the callback only once after a set amount of time, if its counter is not reset during that time. */
116
+
};
117
+
```
118
+
119
+
Пример использования режима STRICT_INTERVAL и UNSTABLE_INTERVAL:
Разница между режимами STRICT_INTERVAL и UNSTABLE_INTERVAL такая, что таймер с режимом UNSTABLE_INTERVAL перед обнулением счетчика ожидает завершение задачи в callback-функции, а режим STRICT_INTERVAL обнуляет счетчик перед вызовом callback-функции.
132
+
133
+
Пример использования режима ONE_SHOT_AFTER_INTERVAL:
STRICT_INTERVAL, /**< First timer mode, where the timer calls the callback at fixed intervals by resetting its internal counter before the callback is called. */
46
+
UNSTABLE_INTERVAL, /**< Second timer mode, where the timer resets its counter after the callback is called, making the period between callbacks unstable. */
47
+
ONE_SHOT_AFTER_INTERVAL, /**< Third timer mode, where the timer calls the callback only once after a set amount of time, if its counter is not reset during that time. */
0 commit comments