Files
Cnomicon/include/libnet++/PosixTimer.h
2021-01-22 10:16:20 -05:00

67 lines
1.3 KiB
C++

//
// 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