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.SetAsyncMicrosoft.VisualStudio.Threading.AsyncManualResetEvent.SetAsync 如果此值为 true ,则调用方不应持有私有锁以避免死锁。 为 false时,从返回的任务 WaitAsync() 可能未完全转换为其已完成状态 Microsoft.VisualStudio.Threading.AsyncManualResetEvent.SetAsync

注解

false 更好地模拟类的行为 ManualResetEventSlim ,但 true 可能会导致性能略有提高。

适用于