Waitable Timer Kernel Objects

Waitable timers are kernel objects that signal themselves at a certain time or at regular intervals. They are most commonly used to have some operation performed at a certain time.

To create a waitable timer, you simply call CreateWaitableTimer:

HANDLE CreateWaitableTimer(
   PSECURITY_ATTRIBUTES psa,
   BOOL bManualReset,
   PCTSTR pszName);

The psa and pszName parameters are discussed in Chapter 3. Of course, a process can obtain its own process-relative handle to an existing waitable timer by calling OpenWaitableTimer:

HANDLE OpenWaitableTimer(
   DWORD dwDesiredAccess,
   BOOL bInheritHandle,
   PCTSTR pszName);

As with events, the bManualReset parameter indicates a manual-reset or auto-reset timer. When a manual-reset timer is signaled, ...

Get Windows® via C/C++, Fifth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.