1 /*****************************************************************************\
4 * Author : Chris Koeritz *
6 *******************************************************************************
7 * Copyright (c) 1998-$now By Author. This program is free software; you can *
8 * redistribute it and/or modify it under the terms of the GNU General Public *
9 * License as published by the Free Software Foundation; either version 2 of *
10 * the License or (at your option) any later version. This is online at: *
11 * http://www.fsf.org/copyleft/gpl.html *
12 * Please send any updates to: fred@gruntose.com *
13 \*****************************************************************************/
15 #include "safe_roller.h"
17 #include <basis/functions.h>
18 #include <basis/mutex.h>
19 #include <structures/roller.h>
20 #include <structures/static_memory_gremlin.h>
22 using namespace basis;
23 using namespace structures;
27 SAFE_STATIC(mutex, __roller_synch, )
29 void safe_add(int &to_change, int addition)
31 auto_synchronizer l(__roller_synch());
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)),
43 safe_roller::~safe_roller()
49 int safe_roller::next_id()
52 int to_return = _rolling->next_id();
57 int safe_roller::current() const
60 int to_return = _rolling->current();
65 void safe_roller::set_current(int new_current)
68 _rolling->set_current(new_current);