Timer.h File Reference

#include <errno.h>
#include <sys/types.h>
#include <sys/time.h>
#include <queue>
#include <signal.h>
#include "config.h"
#include "../debug/DebugUtils.h"
#include "../debug/Log.h"
#include "../util/Singleton.h"
#include "MsgQueue.h"
#include "OnOffNotifier.h"
#include "Thread.h"

Go to the source code of this file.

Namespaces

namespace  oasys

Classes

class  oasys::TimerCompare
 The Timer comparison class. More...
class  oasys::TimerSystem
 The main Timer system implementation that needs to be driven by a thread, such as the TimerThread class defined below. More...
class  oasys::TimerThread
 A simple thread class that drives the TimerSystem implementation. More...
class  oasys::Timer
 A Timer class. More...
struct  oasys::TimerEvent
 For use with the QueuingTimer, this struct defines a TimerEvent, i.e. More...
class  oasys::QueuingTimer
 A Timer class that's useful in cases when a separate thread (i.e. More...

Defines

#define TIMEVAL_DIFF(t1, t2, t3)
 Miscellaneous timeval macros.
#define TIMEVAL_DIFF_DOUBLE(t1, t2)
#define TIMEVAL_DIFF_MSEC(t1, t2)
#define TIMEVAL_DIFF_USEC(t1, t2)
#define TIMEVAL_GT(t1, t2)
#define TIMEVAL_LT(t1, t2)

Typedefs

typedef RETSIGTYPE( sighandlerfn_t )(int)
 Typedef for a signal handler function.
typedef MsgQueue< TimerEvent > oasys::TimerEventQueue
 The queue type used in the QueueingTimer.


Define Documentation

#define TIMEVAL_DIFF ( t1,
t2,
t3   ) 

Value:

do { \
       ((t3).tv_sec  = (t1).tv_sec - (t2).tv_sec); \
       ((t3).tv_usec = (t1).tv_usec - (t2).tv_usec); \
       if ((t3).tv_usec < 0) { (t3).tv_sec--; (t3).tv_usec += 1000000; } \
    } while (0)
Miscellaneous timeval macros.

Definition at line 48 of file Timer.h.

#define TIMEVAL_DIFF_DOUBLE ( t1,
t2   ) 

Value:

((double)(((t1).tv_sec  - (t2).tv_sec)) + \
     (double)((((t1).tv_usec - (t2).tv_usec)) * 1000000.0))

Definition at line 55 of file Timer.h.

Referenced by oasys::RateEstimator::timeout().

#define TIMEVAL_DIFF_MSEC ( t1,
t2   ) 

Value:

((unsigned long int)(((t1).tv_sec  - (t2).tv_sec)  * 1000) + \
     (((t1).tv_usec - (t2).tv_usec) / 1000))

Definition at line 59 of file Timer.h.

#define TIMEVAL_DIFF_USEC ( t1,
t2   ) 

Value:

((unsigned long int)(((t1).tv_sec  - (t2).tv_sec)  * 1000000) + \
     (((t1).tv_usec - (t2).tv_usec)))

Definition at line 63 of file Timer.h.

#define TIMEVAL_GT ( t1,
t2   ) 

Value:

(((t1).tv_sec  >  (t2).tv_sec) ||  \
     (((t1).tv_sec == (t2).tv_sec) && ((t1).tv_usec > (t2).tv_usec)))

Definition at line 67 of file Timer.h.

Referenced by oasys::TimerCompare::operator()().

#define TIMEVAL_LT ( t1,
t2   ) 

Value:

(((t1).tv_sec  <  (t2).tv_sec) ||  \
     (((t1).tv_sec == (t2).tv_sec) && ((t1).tv_usec < (t2).tv_usec)))

Definition at line 71 of file Timer.h.

Referenced by oasys::TimerSystem::run_expired_timers().


Typedef Documentation

typedef RETSIGTYPE( sighandlerfn_t)(int)

Typedef for a signal handler function.

On some (but not all) systems, there is a system-provided __sighandler_t typedef that is equivalent, but in other cases __sighandler_t is a function pointer (not a function).

Definition at line 41 of file Timer.h.


Generated on Thu Jun 7 16:56:54 2007 for DTN Reference Implementation by  doxygen 1.5.1