MySQL 9.1.0
Source Code Documentation
|
A counter which tracks number of things left to do, which can be incremented or decremented, and lets one await the value drop to zero. More...
#include <ut0todo_counter.h>
Public Member Functions | |
Todo_counter () | |
Initializes the counter to 0. More... | |
void | increment () |
Increments the value of the counter. More... | |
void | decrement () |
Decrements the value of the counter. More... | |
void | await_zero () |
Returns when the value is zero. More... | |
size_t | value () |
Returns current value of the counter. More... | |
Private Attributes | |
size_t | m_todos {0} |
Os_event_t | m_is_zero {} |
A counter which tracks number of things left to do, which can be incremented or decremented, and lets one await the value drop to zero.
Enforcing a total order on calls to increment(), decrement() and value() is a responsibility of a user of this class. With above assumption the await_zero() can be called safely at any moment, as increment() and decrement() take care of resetting and setting the awaited event object properly.
|
inline |
Initializes the counter to 0.
|
inline |
Returns when the value is zero.
|
inline |
Decrements the value of the counter.
|
inline |
Increments the value of the counter.
|
inline |
Returns current value of the counter.
|
private |
|
private |