MLIB
Loading...
Searching...
No Matches
wtimer.h
Go to the documentation of this file.
1
6#pragma once
7
8#include "syncbase.h"
9
10namespace mlib {
11
12class wtimer : public syncbase
13{
14public:
16 enum mode
17 {
18 manual,
19 automatic
20 };
21
22 wtimer (mode m = automatic, const std::string& name = std::string (), bool use_apc = false);
23 void start (DWORD interval_ms, DWORD period_ms = 0);
24 void at (FILETIME& utctime, DWORD period_ms = 0);
25 void stop ();
26
27protected:
31 virtual void at_timer (DWORD loval, DWORD hival) {};
32
33private:
34 bool apc_;
35 static void CALLBACK timerProc (wtimer* obj, DWORD loval, DWORD hival);
36};
37
38} // namespace mlib
Base class for all named synchronization objects.
Definition syncbase.h:27
virtual const std::string & name() const
Return object's name.
Definition syncbase.h:60
Waitable timer.
Definition wtimer.h:13
virtual void at_timer(DWORD loval, DWORD hival)
Function called for timers that use the APC feature.
Definition wtimer.h:31
void start(DWORD interval_ms, DWORD period_ms=0)
Set the start time of the timer and it's period.
Definition wtimer.cpp:63
void stop()
Stop the timer.
Definition wtimer.cpp:85
void at(FILETIME &utctime, DWORD period_ms=0)
Set the timer at an absolute time.
Definition wtimer.cpp:76
mode
Timer mode.
Definition wtimer.h:17
syncbase class definition.