語言

AsyncManualResetEvent(Boolean, Boolean) 建構函式

定義

初始化 AsyncManualResetEvent 類別的新執行個體。

 AsyncManualResetEvent(bool initialState = false, bool allowInliningAwaiters = false);
public AsyncManualResetEvent(bool initialState = false, bool allowInliningAwaiters = false);
new Microsoft.VisualStudio.Threading.AsyncManualResetEvent : bool * bool -> Microsoft.VisualStudio.Threading.AsyncManualResetEvent
Public Sub New (Optional initialState As Boolean = false, Optional allowInliningAwaiters As Boolean = false)

參數

initialState
Boolean

一個表示事件是否應先被發出訊號的值。

allowInliningAwaiters
Boolean

一個值,表示是否允許 WaitAsync() 呼叫者的延續在呼叫回傳前的執行緒 Microsoft.VisualStudio.Threading.AsyncManualResetEvent.SetAsync 執行。 Microsoft.VisualStudio.Threading.AsyncManualResetEvent.SetAsync 若此數值為 true 避免死結,呼叫者不應保留私有鎖。 當 false時,從 返回的 WaitAsync() 任務可能尚未完全轉換到完成狀態,直到 Microsoft.VisualStudio.Threading.AsyncManualResetEvent.SetAsync 返回呼叫者。

備註

false 更佳模擬類別的ManualResetEventSlim 行為,但 true 可能帶來稍微更好的效能。

適用於