CountdownEvent.Wait 方法  
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
阻止当前线程,直到设置了 CountdownEvent 为止。
重载
| Wait() | 阻止当前线程,直到设置了 CountdownEvent 为止。 | 
| Wait(Int32) | 阻止当前线程,直到设置了 CountdownEvent 为止,同时使用 32 位带符号整数测量超时。 | 
| Wait(CancellationToken) | 阻止当前线程,直到设置了 CountdownEvent 为止,同时观察 CancellationToken。 | 
| Wait(TimeSpan) | 阻止当前线程,直到设置了 CountdownEvent 为止,同时使用 TimeSpan 测量超时。 | 
| Wait(Int32, CancellationToken) | 阻止当前线程,直到设置了 CountdownEvent 为止,并使用 32 位带符号整数测量超时,同时观察 CancellationToken。 | 
| Wait(TimeSpan, CancellationToken) | 阻止当前线程,直到设置了 CountdownEvent 为止,并使用 TimeSpan 测量超时,同时观察 CancellationToken。 | 
Wait()
- Source:
- CountdownEvent.cs
- Source:
- CountdownEvent.cs
- Source:
- CountdownEvent.cs
阻止当前线程,直到设置了 CountdownEvent 为止。
public:
 void Wait();public void Wait ();[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public void Wait ();member this.Wait : unit -> unit[<System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
member this.Wait : unit -> unitPublic Sub Wait ()- 属性
例外
已释放当前实例。
注解
此方法的调用方无限期阻止,直到设置当前实例。 如果事件当前处于设置状态,则调用方将立即返回 。
另请参阅
适用于
Wait(Int32)
- Source:
- CountdownEvent.cs
- Source:
- CountdownEvent.cs
- Source:
- CountdownEvent.cs
阻止当前线程,直到设置了 CountdownEvent 为止,同时使用 32 位带符号整数测量超时。
public:
 bool Wait(int millisecondsTimeout);public bool Wait (int millisecondsTimeout);[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public bool Wait (int millisecondsTimeout);member this.Wait : int -> bool[<System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
member this.Wait : int -> boolPublic Function Wait (millisecondsTimeout As Integer) As Boolean参数
返回
如果已设置 CountdownEvent,则为 true;否则为 false。
- 属性
例外
已释放当前实例。
              millisecondsTimeout 是一个非 -1 的负数,而 -1 表示无限期超时。
另请参阅
适用于
Wait(CancellationToken)
- Source:
- CountdownEvent.cs
- Source:
- CountdownEvent.cs
- Source:
- CountdownEvent.cs
阻止当前线程,直到设置了 CountdownEvent 为止,同时观察 CancellationToken。
public:
 void Wait(System::Threading::CancellationToken cancellationToken);public void Wait (System.Threading.CancellationToken cancellationToken);[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public void Wait (System.Threading.CancellationToken cancellationToken);member this.Wait : System.Threading.CancellationToken -> unit[<System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
member this.Wait : System.Threading.CancellationToken -> unitPublic Sub Wait (cancellationToken As CancellationToken)参数
- cancellationToken
- CancellationToken
要观察的 CancellationToken。
- 属性
例外
              cancellationToken 已取消。
注解
此方法的调用方无限期阻止,直到设置当前实例。 如果事件当前处于设置状态,则调用方将立即返回 。 CancellationToken如果在等待操作期间取消观察到的 ,OperationCanceledException则会引发 。
另请参阅
适用于
Wait(TimeSpan)
- Source:
- CountdownEvent.cs
- Source:
- CountdownEvent.cs
- Source:
- CountdownEvent.cs
阻止当前线程,直到设置了 CountdownEvent 为止,同时使用 TimeSpan 测量超时。
public:
 bool Wait(TimeSpan timeout);public bool Wait (TimeSpan timeout);[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public bool Wait (TimeSpan timeout);member this.Wait : TimeSpan -> bool[<System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
member this.Wait : TimeSpan -> boolPublic Function Wait (timeout As TimeSpan) As Boolean参数
返回
如果已设置 CountdownEvent,则为 true;否则为 false。
- 属性
例外
已释放当前实例。
              timeout 是一个负数,而不是 -1 毫秒,表示无限超时 -或超时大于 Int32.MaxValue。
另请参阅
适用于
Wait(Int32, CancellationToken)
- Source:
- CountdownEvent.cs
- Source:
- CountdownEvent.cs
- Source:
- CountdownEvent.cs
阻止当前线程,直到设置了 CountdownEvent 为止,并使用 32 位带符号整数测量超时,同时观察 CancellationToken。
public:
 bool Wait(int millisecondsTimeout, System::Threading::CancellationToken cancellationToken);public bool Wait (int millisecondsTimeout, System.Threading.CancellationToken cancellationToken);[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public bool Wait (int millisecondsTimeout, System.Threading.CancellationToken cancellationToken);member this.Wait : int * System.Threading.CancellationToken -> bool[<System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
member this.Wait : int * System.Threading.CancellationToken -> boolPublic Function Wait (millisecondsTimeout As Integer, cancellationToken As CancellationToken) As Boolean参数
- cancellationToken
- CancellationToken
要观察的 CancellationToken。
返回
如果已设置 CountdownEvent,则为 true;否则为 false。
- 属性
例外
              cancellationToken 已取消。
已释放当前实例。 - 或 - 创建 cancellationToken 的 CancellationTokenSource 已被释放。
              millisecondsTimeout 是一个非 -1 的负数,而 -1 表示无限期超时。
另请参阅
适用于
Wait(TimeSpan, CancellationToken)
- Source:
- CountdownEvent.cs
- Source:
- CountdownEvent.cs
- Source:
- CountdownEvent.cs
阻止当前线程,直到设置了 CountdownEvent 为止,并使用 TimeSpan 测量超时,同时观察 CancellationToken。
public:
 bool Wait(TimeSpan timeout, System::Threading::CancellationToken cancellationToken);public bool Wait (TimeSpan timeout, System.Threading.CancellationToken cancellationToken);[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public bool Wait (TimeSpan timeout, System.Threading.CancellationToken cancellationToken);member this.Wait : TimeSpan * System.Threading.CancellationToken -> bool[<System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
member this.Wait : TimeSpan * System.Threading.CancellationToken -> boolPublic Function Wait (timeout As TimeSpan, cancellationToken As CancellationToken) As Boolean参数
- cancellationToken
- CancellationToken
要观察的 CancellationToken。
返回
如果已设置 CountdownEvent,则为 true;否则为 false。
- 属性
例外
              cancellationToken 已取消。
已释放当前实例。 - 或 - 创建 cancellationToken 的 CancellationTokenSource 已被释放。
              timeout 是一个负数,而不是 -1 毫秒,表示无限超时 -或超时大于 Int32.MaxValue。