DispatcherQueue DispatcherQueue DispatcherQueue DispatcherQueue Class

Definition

Manages a prioritized queue on which tasks execute in a serial fashion on a thread.

public : sealed class DispatcherQueue
struct winrt::Windows::System::DispatcherQueue
public sealed class DispatcherQueue
Public NotInheritable Class DispatcherQueue
Attributes

Windows 10 requirements

Device family
Windows 10 Fall Creators Update (introduced v10.0.16299.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v5)

Remarks

All tasks dispatched to a queue execute on the same thread.

Version history

Windows version SDK version Value added
1903 18362 HasThreadAccess

Properties

HasThreadAccess HasThreadAccess HasThreadAccess HasThreadAccess

Gets a value indicating whether the DispatcherQueue has access to the current thread.

Methods

CreateTimer() CreateTimer() CreateTimer() CreateTimer()

Creates a DispatcherQueueTimer on the DispatcherQueue to execute a task periodically after a time interval has elapsed.

GetForCurrentThread() GetForCurrentThread() GetForCurrentThread() GetForCurrentThread()

Gets the DispatcherQueue associated with the current thread.

TryEnqueue(DispatcherQueueHandler) TryEnqueue(DispatcherQueueHandler) TryEnqueue(DispatcherQueueHandler) TryEnqueue(DispatcherQueueHandler)

Adds a task to the DispatcherQueue which will be executed on the thread associated with the DispatcherQueue.

TryEnqueue(DispatcherQueuePriority, DispatcherQueueHandler) TryEnqueue(DispatcherQueuePriority, DispatcherQueueHandler) TryEnqueue(DispatcherQueuePriority, DispatcherQueueHandler) TryEnqueue(DispatcherQueuePriority, DispatcherQueueHandler)

Adds a task to the DispatcherQueue which will be executed on the thread associated with the DispatcherQueue.

Events

ShutdownCompleted ShutdownCompleted ShutdownCompleted ShutdownCompleted

Fires after the DispatcherQueue event loop stops which is the last step in the DispatcherQueue shutdown process.

ShutdownStarting ShutdownStarting ShutdownStarting ShutdownStarting

Fires before the dispatcher queue initiates an exit from its event loop.