.NET Framework Class Library |
ManualResetEventSlim..::.Wait Method (Int32, CancellationToken) |
ManualResetEventSlim Class See Also Send Feedback |
Blocks the current thread until the current ManualResetEventSlim is set, using a
32-bit signed integer to measure the time interval, while observing a CancellationToken.
Namespace:
System.Threading
Assembly:
System.Threading (in System.Threading.dll)
Syntax
Visual Basic (Declaration) |
---|
Public Function Wait ( _ millisecondsTimeout As Integer, _ cancellationToken As CancellationToken _ ) As Boolean |
C# |
---|
public bool Wait( int millisecondsTimeout, CancellationToken cancellationToken ) |
Parameters
- millisecondsTimeout
- Type: System..::.Int32
The number of milliseconds to wait, or Infinite(-1) to wait indefinitely.
- cancellationToken
- Type: System.Threading..::.CancellationToken
The CancellationToken to observe.
Return Value
true if the ManualResetEventSlim was set; otherwise, false.Exceptions
Exception | Condition |
---|---|
System..::.ArgumentOutOfRangeException | millisecondsTimeout is a negative number other than -1, which represents an infinite time-out. |
System..::.InvalidOperationException | The maximum number of waiters has been exceeded. |
OperationCanceledException | cancellationToken was canceled. |