3 #include <winpr/synch.h>
5 int TestSynchWaitableTimer(
int argc,
char* argv[])
10 LARGE_INTEGER due = { 0 };
14 timer = CreateWaitableTimer(NULL, FALSE, NULL);
18 printf(
"CreateWaitableTimer failure\n");
22 due.QuadPart = -1500000LL;
24 if (!SetWaitableTimer(timer, &due, 0, NULL, NULL, 0))
26 printf(
"SetWaitableTimer failure\n");
30 status = WaitForSingleObject(timer, INFINITE);
32 if (status != WAIT_OBJECT_0)
34 printf(
"WaitForSingleObject(timer, INFINITE) failure\n");
38 printf(
"Timer Signaled\n");
39 status = WaitForSingleObject(timer, 200);
41 if (status != WAIT_TIMEOUT)
43 printf(
"WaitForSingleObject(timer, 200) failure: Actual: 0x%08" PRIX32
44 ", Expected: 0x%08X\n",
45 status, WAIT_TIMEOUT);
52 if (!SetWaitableTimer(timer, &due, period, NULL, NULL, 0))
54 printf(
"SetWaitableTimer failure\n");
58 if (WaitForSingleObject(timer, INFINITE) != WAIT_OBJECT_0)
60 printf(
"WaitForSingleObject(timer, INFINITE) failure\n");
64 printf(
"Timer Signaled\n");
66 if (!SetWaitableTimer(timer, &due, period, NULL, NULL, 0))
68 printf(
"SetWaitableTimer failure\n");
72 if (WaitForMultipleObjects(1, &timer, FALSE, INFINITE) != WAIT_OBJECT_0)
74 printf(
"WaitForMultipleObjects(timer, INFINITE) failure\n");
78 printf(
"Timer Signaled\n");
81 (void)CloseHandle(timer);