5 #ifndef __IntraProcessCounter__ 6 #define __IntraProcessCounter__ 11 #include <arc/Thread.h> 13 #include <arc/Counter.h> 119 Glib::TimeVal duration =
ETERNAL,
120 bool prioritized =
false,
121 Glib::TimeVal timeOut =
ETERNAL);
149 Glib::TimeVal& expiryTime,
150 Glib::TimeVal duration =
ETERNAL);
176 int unsafeGetValue();
189 int unsafeCancel(
IDType reservationID);
203 IDType unsafeReserve(
int amount, Glib::TimeVal duration);
211 Glib::TimeVal unsafeGetNextExpiration();
244 std::map<IDType, int> reservations;
251 std::priority_queue<ExpirationReminder> selfExpiringReservations;
258 Glib::Mutex synchMutex;
265 Glib::Cond synchCond;
Arc namespace contains all core ARC classes.
Definition: ArcConfig.h:11
A class defining a common interface for counters.
Definition: Counter.h:105
virtual int setExcess(int newExcess)
Sets the excess limit of the counter.
const Glib::TimeVal ETERNAL
A time very far in the future.
virtual int setLimit(int newLimit)
Sets the limit of the counter.
IntraProcessCounter(int limit, int excess)
Creates an IntraProcessCounter with specified limit and excess.
A class for "tickets" that correspond to counter reservations.
Definition: Counter.h:347
virtual void cancel(IDType reservationID)
Cancellation of a reservation.
virtual void extend(IDType &reservationID, Glib::TimeVal &expiryTime, Glib::TimeVal duration=ETERNAL)
Extension of a reservation.
virtual int getExcess()
Returns the excess limit of the counter.
virtual int getLimit()
Returns the current limit of the counter.
virtual ~IntraProcessCounter()
Destructor.
virtual CounterTicket reserve(int amount=1, Glib::TimeVal duration=ETERNAL, bool prioritized=false, Glib::TimeVal timeOut=ETERNAL)
Makes a reservation from the counter.
unsigned long long int IDType
A typedef of identification numbers for reservation.
Definition: Counter.h:116
virtual int changeExcess(int amount)
Changes the excess limit of the counter.
virtual int changeLimit(int amount)
Changes the limit of the counter.
A class for counters used by threads within a single process.
Definition: IntraProcessCounter.h:24
virtual int getValue()
Returns the current value of the counter.