Main Page   Packages   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

C:/temp/src/j2k/Net/TFTP/Timer.hpp

Go to the documentation of this file.
00001 // Required library:  -lrt
00002 
00003 #ifndef __J2K__Timer_HPP__
00004 #define __J2K__Timer_HPP__
00005 
00006 #include <j2k/Fred/Standard.hpp>
00007 #include <j2k/Fred/Error/JErrorController.hpp>
00008 
00009 #include <unistd.h>
00010 #include <errno.h>
00011 #include <pthread.h>
00012 #include <signal.h>
00013 #include <sys/time.h>
00014 
00015 #if !defined( linux )
00016 #include <sys/siginfo.h>
00017 #endif
00018 
00019 // 16-17
00020 #define  TimerSignal  SIGUSR1  
00021 
00022 class Timer;
00023 
00024 // Only one timer can exist at a given time
00025 Timer*  theTimer = NULL;
00026 
00027 class Timer {
00028 public:
00029 
00030   // Setup a timer, to be started later.
00031   Timer( ULONG nsec, ULONG sec = 0 );
00032 
00033   inline void start();
00034 
00035   // Use the global variable for to call the real handler
00036   static void wrapper( int signo )
00037   {
00038     theTimer->timedRun( signo ); 
00039   }
00040 
00041   // Should be implement by children class
00042   virtual void timedRun( int signo ) = 0;
00043 
00044 private:
00045   clockid_t timerid;
00046   struct sigevent   event;
00047   struct itimerspec t;
00048 };
00049 
00050 #endif

Generated on Sun Oct 14 18:46:20 2001 for Standard J2K Library by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001