Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

MNTimer Class Reference

#include <MNTimer.h>

Inheritance diagram for MNTimer:

Inheritance graph
[legend]
Collaboration diagram for MNTimer:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 MNTimer (MNSelector &selector, const char *debug_creator_string)
virtual ~MNTimer ()
void insert_abs_timer (TimerCallBase *timerptr, const struct timeval &timeout, bool inCallback, const char *owner)
void reschedule_abs_timer (TimerCallBase *timerptr, const struct timeval &timeout, bool inCallback, const char *owner)
void insert_rel_timer (TimerCallBase *timerptr, const struct timeval &timeout, bool inCallback, const char *owner)
void reschedule_rel_timer (TimerCallBase *timerptr, const struct timeval &timeout, bool inCallback, const char *owner)
void insert_periodic_timer (TimerCallBase *timerptr, const struct timeval &timeout, bool inCallback, const char *owner)
void cancel_timer (TimerCallBase *timerptr)
void cancel_all_timer ()
void wait_usec (long time_)
virtual void start_timer ()
 dummy function - allows transparent use of AutonomousTimers
virtual void terminate_timer ()
 dummy function - allows transparent use of AutonomousTimers
MNSelectorgetSelector ()

Static Public Attributes

const bool InCallback = true
const bool NotInCallback = false

Detailed Description

class MNTimer Requested change: consider object pointers first and fd numbers second in callbacks. That is safer. Change the integer identifier's name from fd to something that makes more sense.


Constructor & Destructor Documentation

MNTimer::MNTimer MNSelector selector,
const char *  debug_creator_string
 

Constructor.

virtual MNTimer::~MNTimer  )  [virtual]
 

Destructor.


Member Function Documentation

void MNTimer::cancel_all_timer  ) 
 

Cancels all active timers.

void MNTimer::cancel_timer TimerCallBase timerptr  ) 
 

Removes the timer uniquely identified by the parameter fd from the list of waiting timers, or if necessary, cancels this timer and selects a new front of the waiting timers' queue.

Parameters:
timerptr Unique timer callback identifier.

MNSelector& MNTimer::getSelector  ) 
 

Get this selector for re-use. This may allow to use just one timer and to have several other timers run in the same thread.

void MNTimer::insert_abs_timer TimerCallBase timerptr,
const struct timeval &  timeout,
bool  inCallback,
const char *  owner
 

Inserts a timer with an absolute timeout time. The time must be provided in UCT for the time of the next timeout. The registered timecall is deleted from this timer after one execution of the callback. No other calls are generated by it.

Parameters:
timerptr A pointer to the object that is called by this timeout. It is also used for the unique identification of the object that must be called.
timeout The absolute time for executing the callback.
inCallback Setting inCallback to true prevents the timer from sending a notification to the notifier pipe. If this is not done, a change to a timer in a timer callback will always result in a double firing of the selector, which is a waste of time.

void MNTimer::insert_periodic_timer TimerCallBase timerptr,
const struct timeval &  timeout,
bool  inCallback,
const char *  owner
 

Adds a timer that is called repeatedly. Once started, this time is repeated in intervals specified by the timeout parameter until it is (or all timers are) explicitly terminated.

Parameters:
timerptr Pointer to the timer callback object and unique identifier.
timeout The delay to wait between two consecutive executions of the callback.
inCallback Set to true if it is not necessary to wake the selector.

void MNTimer::insert_rel_timer TimerCallBase timerptr,
const struct timeval &  timeout,
bool  inCallback,
const char *  owner
 

Similar to insert_abs_timer(), but timeout value is interpreted as an offset from the current time, rather than a fixed time.

Parameters:
timerptr Pointer to the timer callback object and unique identifier.
timeout The delay to wait before executing the callback.
inCallback Set to true if it is not necessary to wake the selector.

void MNTimer::reschedule_abs_timer TimerCallBase timerptr,
const struct timeval &  timeout,
bool  inCallback,
const char *  owner
 

Identical to insert_abs_timer() but not protected by a mutex, since this call can only be made from the timer_callback function.

Parameters:
timerptr Pointer to the timer callback object and unique identifier.
timeout The absolute time in UCT for executing the callback.
inCallback Set to true if it is not necessary to wake the selector.

void MNTimer::reschedule_rel_timer TimerCallBase timerptr,
const struct timeval &  timeout,
bool  inCallback,
const char *  owner
 

Identical to insert_rel_timer() but not protected by a mutex, since this call can only be made from the timer_callback function.

Parameters:
timerptr Pointer to the timer callback object and unique identifier.
timeout The delay to wait before executing the callback.
inCallback Set to true if it is not necessary to wake the selector.

virtual void MNTimer::start_timer  )  [virtual]
 

dummy function - allows transparent use of AutonomousTimers

Reimplemented in AutonomousTimer.

virtual void MNTimer::terminate_timer  )  [virtual]
 

dummy function - allows transparent use of AutonomousTimers

Reimplemented in AutonomousTimer.

void MNTimer::wait_usec long  time_  ) 
 

Halts the calling process for the given number of micro-seconds.

Parameters:
time_ The number of micro-seconds.


Member Data Documentation

const bool MNTimer::InCallback = true [static]
 

const bool MNTimer::NotInCallback = false [static]
 


The documentation for this class was generated from the following file:
Generated on Sun Mar 6 13:36:03 2005 for Komssys by doxygen 1.3.8