#include <Thread.h>
Public Member Functions | |
virtual int | inc (void) |
virtual int | dec (void) |
virtual int | get (void) const |
virtual int | set (int v) |
virtual void | wait (void) const |
virtual bool | wait (int t) const |
virtual void | forceReset (void) |
Thread-safe counter with capability to wait for zero value. It is extendable 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 | ) | [inline, virtual] |
This method is meant to be used only after fork.
It resets state of all internal locks and variables.
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.