DispatcherQueueController.CreateOnCurrentThread 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
在呼叫執行緒中,建立一個 DispatcherQueue ,該佇列可與 USER32 訊息迴圈互通。
public:
static DispatcherQueueController ^ CreateOnCurrentThread();
static DispatcherQueueController CreateOnCurrentThread();
public static DispatcherQueueController CreateOnCurrentThread();
function createOnCurrentThread()
Public Shared Function CreateOnCurrentThread () As DispatcherQueueController
傳回
呼叫執行緒上的 DispatcherQueue 。
備註
會建立一個 DispatcherQueue ,並與目前執行緒相關聯。 如果目前執行緒已經關聯了 DispatcherQueue ,則會發生錯誤。 你可以透過 DispatcherQueueController.DispatcherQueue 存取已建立的 DispatcherQueue。
為了讓調度器佇列能派遣任務,目前執行緒必須持續發送訊息。 在當前執行緒退出前,必須呼叫 DispatcherQueueController.ShutdownQueueAsync,並持續發送訊息直到 IAsyncAction 完成;或者呼叫 DispatcherQueueController.ShutdownQueue,但該排隊直到隊列關閉後才會回傳。