WdfTimerStop function (wdftimer.h)

[Applies to KMDF and UMDF]

The WdfTimerStop method stops a timer's clock.

Syntax

BOOLEAN WdfTimerStop(
  [in] WDFTIMER Timer,
  [in] BOOLEAN  Wait
);

Parameters

[in] Timer

A handle to a framework timer object that was obtained by calling WdfTimerCreate.

[in] Wait

KMDF A Boolean value that, if TRUE, specifies that the framework does not return until all queued calls to the driver's deferred procedure calls (DPCs), including the driver's EvtTimerFunc callback functions, have executed.

UMDF A Boolean value that, if TRUE, specifies that the framework does not return until all queued calls to the timer's EvtTimerFunc callback function have executed.

Return value

WdfTimerStop returns TRUE if the timer object was in the system's timer queue. Otherwise, this method returns FALSE. For more information, see the following Remarks section.

A bug check occurs if the driver supplies an invalid object handle.

Remarks

When a driver calls WdfTimerStart, its timer object is added to the system's queue of timer objects. If the timer is not a periodic timer, the system removes the timer object from the queue after the timer's "due time" has elapsed. If the timer is a periodic timer, the timer object remains in the queue until the driver calls WdfTimerStop.

For more information about framework timer objects, see Using Timers.

WdfTimerStop must be called at IRQL = PASSIVE_LEVEL if the Wait parameter is TRUE. Otherwise, this method must be called at IRQL <= DISPATCH_LEVEL.

Do not call WdfTimerStop from inside EvtTimerFunc with the Wait parameter set to TRUE. Doing so may result in deadlock.

Caution

Concurrent calls to WdfTimerStop on the same timer object will break into the debugger if Verifier is enabled. For more info, see Using KMDF Verifier.

Examples

The following code example stops a specified timer and waits for all of the driver's queued DPCs to execute.

WdfTimerStop(
             timerHandle,
             TRUE
             );

Requirements

Requirement Value
Target Platform Universal
Minimum KMDF version 1.0
Minimum UMDF version 2.0
Header wdftimer.h (include Wdf.h)
Library Wdf01000.sys (KMDF); WUDFx02000.dll (UMDF)
IRQL See Remarks section.
DDI compliance rules DriverCreate(kmdf), KmdfIrql(kmdf), KmdfIrql2(kmdf), KmdfIrqlExplicit(kmdf)

See also

EvtTimerFunc

WdfTimerCreate

WdfTimerStart