Skip to content

Commit 23cffc9

Browse files
committed
README: document size() and empty()
1 parent 47ab32a commit 23cffc9

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,16 @@ To **cancel** all *Task*s
6161
timer.cancel();
6262
```
6363

64+
Check if a timer is **empty** - no active *Task*s
65+
```cpp
66+
if (timer.empty()) { /* no active tasks */ }
67+
```
68+
69+
Get the number of active *Task*s
70+
```cpp
71+
auto active_tasks = timer.size();
72+
```
73+
6474
Be fancy with **lambdas**
6575
```cpp
6676
timer.in(1000, [](void*) -> bool { return false; });
@@ -126,6 +136,12 @@ void cancel();
126136

127137
/* Returns the ticks until next event, or 0 if none */
128138
unsigned long ticks();
139+
140+
/* Number of active tasks in the timer */
141+
size_t size() const;
142+
143+
/* True if there are no active tasks */
144+
bool empty() const;
129145
```
130146
131147
### Installation

0 commit comments

Comments
 (0)