DispatcherQueue 類別

定義

管理執行緒上以序列方式執行工作的優先順序佇列。

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
繼承
Object Platform::Object IInspectable DispatcherQueue
屬性

Windows 需求

裝置系列
Windows 10 Fall Creators Update (已於 10.0.16299.0 引進)
API contract
Windows.Foundation.UniversalApiContract (已於 v5.0 引進)

備註

分派至佇列的所有工作都會在相同的執行緒上執行。

版本歷程記錄

Windows 版本 SDK 版本 已新增值
1903 18362 HasThreadAccess

屬性

HasThreadAccess

取得值,指出 DispatcherQueue 是否具有目前線程的存取權。

方法

CreateTimer()

DispatcherQueue 上建立 DispatcherQueueTimer,在經過時間間隔之後定期執行工作。

GetForCurrentThread()

取得與目前線程相關聯的 DispatcherQueue

TryEnqueue(DispatcherQueueHandler)

將工作新增至 DispatcherQueue ,這會在與 DispatcherQueue相關聯的執行緒上執行。

TryEnqueue(DispatcherQueuePriority, DispatcherQueueHandler)

將工作新增至 DispatcherQueue ,這會在與 DispatcherQueue相關聯的執行緒上執行。

事件

ShutdownCompleted

呼叫 ShutdownQueueAsync 時引發。 如需引發之事件的完整清單,以及依何種順序,請參閱 ShutdownQueueAsync的。

ShutdownStarting

呼叫 ShutdownQueueAsync 時引發。 如需引發之事件的完整清單,以及依何種順序,請參閱 ShutdownQueueAsync的。

適用於

另請參閱