MCPcopy Create free account
hub / github.com/Windscribe/Desktop-App / createTimer

Function createTimer

src/client/client-common/utils/timer_win.cpp:5–24  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3namespace timer_win {
4
5HANDLE createTimer(int timeout, bool singleShot, PTIMERAPCROUTINE completionRoutine, LPVOID argToCompletionRoutine)
6{
7 HANDLE hTimer = ::CreateWaitableTimer(NULL, FALSE, NULL);
8 if (hTimer == NULL) {
9 return NULL;
10 }
11
12 LARGE_INTEGER initialTimeout;
13 initialTimeout.QuadPart = -(timeout * 10000);
14
15 LONG period = (singleShot ? 0 : timeout);
16
17 BOOL result = ::SetWaitableTimer(hTimer, &initialTimeout, period, completionRoutine, argToCompletionRoutine, FALSE);
18 if (result == FALSE) {
19 ::CloseHandle(hTimer);
20 return NULL;
21 }
22
23 return hTimer;
24}
25
26void cancelTimer(wsl::Win32Handle &timer)
27{

Callers 1

runMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected