Initial commit of files
This commit is contained in:
66
include/libnet++/PosixTimer.h
Normal file
66
include/libnet++/PosixTimer.h
Normal file
@ -0,0 +1,66 @@
|
||||
//
|
||||
// Linux Daemon
|
||||
//
|
||||
|
||||
/* prevent multiple inclusions */
|
||||
#ifndef __PosixTimer__
|
||||
#define __PosixTimer__
|
||||
|
||||
/* includes *****************************************************************/
|
||||
|
||||
#include "Timer.h"
|
||||
|
||||
/* defines ******************************************************************/
|
||||
|
||||
/* macros *******************************************************************/
|
||||
|
||||
/* structs & typedefs *******************************************************/
|
||||
|
||||
/* c class definitions ******************************************************/
|
||||
|
||||
class PosixTimer : public Timer {
|
||||
// public data
|
||||
public:
|
||||
|
||||
// protected data
|
||||
protected:
|
||||
|
||||
// private data
|
||||
private:
|
||||
timer_t m_timerid;
|
||||
struct itimerspec m_value;
|
||||
int m_signal; // signal used
|
||||
bool m_running;
|
||||
bool m_oneshot;
|
||||
|
||||
// public methods
|
||||
public:
|
||||
// constructors
|
||||
PosixTimer();
|
||||
PosixTimer(unsigned long usec);
|
||||
|
||||
// destructor
|
||||
virtual ~PosixTimer();
|
||||
|
||||
// public methods
|
||||
int Restart(void);
|
||||
int Start( unsigned long usec, bool one_shot=true );
|
||||
void Stop(void);
|
||||
unsigned long Remaining(void);
|
||||
int Wait(void);
|
||||
int Sync(void); // Wait()+Restart()
|
||||
|
||||
// virtual functions
|
||||
|
||||
// exceptions
|
||||
|
||||
// static methods
|
||||
|
||||
// private methods
|
||||
private:
|
||||
void Init(void);
|
||||
|
||||
// signal catchers (do not override)
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user