Dispatcher::DisableProcessing Method ()


Disables processing of the Dispatcher queue.

Namespace:   System.Windows.Threading
Assembly:  WindowsBase (in WindowsBase.dll)

DispatcherProcessingDisabled DisableProcessing()

Return Value

Type: System.Windows.Threading::DispatcherProcessingDisabled

A structure used to re-enable dispatcher processing.

Disabling dispatcher processing is an advanced method that is intended to eliminate the chance of unrelated reentrancy.

The effects of disabling processing are as follows:

  • CLR locks will not pump messages internally.

  • DispatcherFrame objects are not allowed to be pushed.

  • Message processing is not permitted.

The DispatcherProcessingDisabled structure that DisableProcessing returns when it is called can be used to re-enable dispatcher processing. Calling Dispose on the DispatcherProcessingDisabled structure re-enables processing.

DisableProcessing can only be called on the thread the Dispatcher is associated with.

The following example shows how to disable dispatcher processing and re-enable dispatcher processing. DisableProcessing is called in a using statement. DisableProcessing returns a DispatcherProcessingDisabled structure that is used as the object to be disposed when the using block finishes. When Dispose is called on the DispatcherProcessingDisabled structure, dispatcher processing is re-enabled.

.NET Framework
Available since 3.0
Return to top
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2015 Microsoft