Skip to content

Commit 0f6b23c

Browse files
committed
src:arduino-timer: empty() function
Timer.empty() returns true if the timer has no active tasks.
1 parent 380c263 commit 0f6b23c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/arduino-timer.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,17 @@ class Timer {
181181
return s;
182182
}
183183

184+
/* True if there are no active tasks */
185+
bool
186+
empty() const
187+
{
188+
timer_foreach_const_task(task) {
189+
if (task->handler) return false;
190+
}
191+
192+
return true;
193+
}
194+
184195
Timer() : ctr(0), tasks{} {}
185196

186197
private:

0 commit comments

Comments
 (0)