46 DL((
REACT,
"Searching for Timer: 0x%x\n",
dynamic_cast<void*
> (eh_)));
51 for (i = 0; i <
m_queue.size (); i++) {
52 if (
m_queue[i]->getHandler() == eh_) {
53 DL((
REACT,
"Found Timer: 0x%x in slot: %d\n",
54 dynamic_cast<void*
>(eh_), i));
75 for (i = 0; i <
m_queue.size (); i++) {
109 DL((
REACT,
"Expired %s [t=%s] timer!\n",
119 tp->rescheduleExpirationTime ();
130 DL((
TRACE,
"Expired total of %d timer(s).\n",cnt));
141 const std::string& name_)
143 trace(
"TimerQueue::insert");
145 Timer* t =
new Timer (eh_, tv_, delta_, name_);
154 trace(
"TimerQueue::dump");
157 DL((
REACT,
"Queue is empty\n"));
160 for (
size_t i = 0; i <
m_queue.size (); ) {
#define trace(s)
trace() is used to trace function call chain in C++ program.
#define DL(X)
A macro for writing debug message to the Logger.
#define trace_with_mask(s, m)
trace_with_mask() is used to trace function call chain in C++ program.
TimerQueue class represents the queue of Timers that application can install for Reactor to dispatch.
virtual int handle_timeout(TimerId tid)
Timeout handler callback.
string fmtString(const char *fmt_=NULL) const
Format timeval structure into readable format.
PriorityQueue< Timer *, TimerCompare > m_queue
Timer queue itself.
int expire(const TimeVal &tv_)
Traverse the queue, triggering all timers that are past argument timeval.
void dump(void)
Dump Queue information to the log file.
int remove(EventHandler *eh_)
Cancel all timers for the EventHandler eh_.
TimerId insert(EventHandler *eh_, const TimeVal &tv_, const TimeVal &delta_, const std::string &name_)
Add timer (EventHandler object) to the queue to be dispatch at the time specified.
EventHandler * getHandler() const
Get EventHandler pointer.
std::string get_id() const
Retrieve Timer ID.
const TimeVal & getExpirationTime() const
Get Expiration Time.
void dump(void)
Dump contents to logfile.
unsigned long TimerId
Timer Id is used in handle_timeout() calls.
@ REACT
Class Reactor/PrioriyQueue messages
@ TRACE
Function call trace
@ REACTTRACE
Extended Reactor/PrioriyQueue messages