22 using namespace basis;
32 to_change += addition;
37 safe_roller::safe_roller(
int start_of_range,
int end_of_range)
38 : _rolling(new
int_roller(start_of_range, end_of_range)),
52 int to_return = _rolling->
next_id();
60 int to_return = _rolling->
current();
auto_synchronizer simplifies concurrent code by automatically unlocking.
void lock()
Clamps down on the mutex, if possible.
void unlock()
Gives up the possession of the mutex.
int next_id()
returns a unique (per instance of this type) id.
void set_current(int new_current)
allows the current id to be manipulated.
int current() const
returns the current id to be used; be careful!
A roller that's based on integers. This is the most common type so far.
contents current() const
returns the current id to be used; be careful!
void set_current(contents new_current)
allows the current id to be manipulated.
contents next_id()
returns a unique (per instance of this type) id.
The guards collection helps in testing preconditions and reporting errors.
void WHACK(contents *&ptr)
deletion with clearing of the pointer.
void safe_add(int &to_change, int addition)
thread-safe integer addition.
A dynamic container class that holds any kind of object via pointers.
#define SAFE_STATIC(type, func_name, parms)
Statically defines a singleton object whose scope is the program's lifetime.