/// <summary> /// Create the timer. The caller should call <see cref="Close"/> as soon as /// the timer is no longer needed. /// </summary> /// <remarks> /// <see cref="WaitHandle.Handle"/> will be used to store the system API /// handle of the newly created timer. /// </remarks> /// <exception cref="TimerException">When the timer could not be created.</exception> public WaitableTimer() { // Create it SafeWaitHandle = CreateWaitableTimer(IntPtr.Zero, false, null); // Test if (SafeWaitHandle.Equals(IntPtr.Zero)) { throw new TimerException("Unable to create Waitable Timer"); } }