Dela via


DispatcherQueue Class

Definition

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

public ref class DispatcherQueue sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 327680)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class DispatcherQueue final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 327680)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class DispatcherQueue
Public NotInheritable Class DispatcherQueue
Inheritance
Object Platform::Object IInspectable DispatcherQueue
Attributes

Windows requirements

Device family
Windows 10 Fall Creators Update (introduced in 10.0.16299.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v5.0)

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

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

Methods

CreateTimer()

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

GetForCurrentThread()

Gets the DispatcherQueue associated with the current thread.

TryEnqueue(DispatcherQueueHandler)

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

TryEnqueue(DispatcherQueuePriority, DispatcherQueueHandler)

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

Events

ShutdownCompleted

Raised when ShutdownQueueAsync is called. For a full list of the events raised, and in what order, see the Remarks for ShutdownQueueAsync.

ShutdownStarting

Raised when ShutdownQueueAsync is called. For a full list of the events raised, and in what order, see the Remarks for ShutdownQueueAsync.

Applies to

See also