Thread-safe counter with capability to wait for zero value.
More...
#include <arc/Thread.h>
|
virtual int | inc (void) |
| Increment value of counter. More...
|
|
virtual int | dec (void) |
| Decrement value of counter. More...
|
|
virtual int | get (void) const |
|
virtual int | set (int v) |
| Set value of counter. More...
|
|
virtual void | wait (void) const |
| Wait for zero condition.
|
|
virtual bool | wait (int t) const |
| Wait for zero condition no longer than t milliseconds. More...
|
|
virtual void | forceReset (void) |
| This method is meant to be used only after fork. More...
|
|
Thread-safe counter with capability to wait for zero value.
It is extendible through re-implementation of virtual methods.
virtual int Arc::SimpleCounter::dec |
( |
void |
| ) |
|
|
virtual |
Decrement value of counter.
- Returns
- new value. Does not go below 0 value.
virtual void Arc::SimpleCounter::forceReset |
( |
void |
| ) |
|
|
inlinevirtual |
This method is meant to be used only after fork.
It resets state of all internal locks and variables.
virtual int Arc::SimpleCounter::get |
( |
void |
| ) |
const |
|
virtual |
- Returns
- current value of counter.
virtual int Arc::SimpleCounter::inc |
( |
void |
| ) |
|
|
virtual |
Increment value of counter.
- Returns
- new value.
virtual int Arc::SimpleCounter::set |
( |
int |
v | ) |
|
|
virtual |
Set value of counter.
- Returns
- new value.
virtual bool Arc::SimpleCounter::wait |
( |
int |
t | ) |
const |
|
virtual |
Wait for zero condition no longer than t milliseconds.
If t is negative - wait forever.
- Returns
- false if timeout occurred.
The documentation for this class was generated from the following file: