MLIB
Loading...
Searching...
No Matches
wtimer.h
Go to the documentation of this file.
1/*
2 Copyright (c) Mircea Neacsu (2014-2025) Licensed under MIT License.
3 This file is part of MLIB project. See LICENSE file for full license terms.
4*/
5
7
8#pragma once
9
10#include "syncbase.h"
11
12namespace mlib {
13
14class wtimer : public syncbase
15{
16public:
18 enum mode
19 {
20 manual,
21 automatic
22 };
23
24 wtimer (mode m = automatic, const std::string& name = std::string (), bool use_apc = false);
25 void start (DWORD interval_ms, DWORD period_ms = 0);
26 void at (FILETIME& utctime, DWORD period_ms = 0);
27 void stop ();
28
29protected:
33 virtual void at_timer (DWORD loval, DWORD hival) {};
34
35private:
36 bool apc_;
37 static void CALLBACK timerProc (wtimer* obj, DWORD loval, DWORD hival);
38};
39
40} // namespace mlib
syncbase()
Default constructor.
Definition syncbase.cpp:37
virtual const std::string & name() const
Return object's name.
Definition syncbase.h:59
Waitable timer.
Definition wtimer.h:15
virtual void at_timer(DWORD loval, DWORD hival)
Function called for timers that use the APC feature.
Definition wtimer.h:33
void start(DWORD interval_ms, DWORD period_ms=0)
Set the start time of the timer and it's period.
Definition wtimer.cpp:55
void stop()
Stop the timer.
Definition wtimer.cpp:77
wtimer(mode m=automatic, const std::string &name=std::string(), bool use_apc=false)
Definition wtimer.cpp:40
void at(FILETIME &utctime, DWORD period_ms=0)
Set the timer at an absolute time.
Definition wtimer.cpp:68
mode
Timer mode.
Definition wtimer.h:19
Definition of mlib::syncbase class.