public Wait ( TimeSpan timeout, |
||
timeout | TimeSpan | |
cancellationToken | ||
return | bool |
public bool Wait(TimeSpan timeout, CancellationToken cancellationToken)
{
return Wait (CheckTimeout (timeout), cancellationToken);
}
ManualResetEventSlim::Wait ( TimeSpan timeout ) : bool | |
ManualResetEventSlim::Wait ( int millisecondsTimeout ) : bool | |
ManualResetEventSlim::Wait ( int millisecondsTimeout, |
|
ManualResetEventSlim::Wait ( ) : void | |
ManualResetEventSlim::Wait ( |
public void BasicUsageTest () { int[] array = null; var evt = new ManualResetEventSlim (false); var buffer = new BatchBlock<int> (10); var block = new ActionBlock<int[]> (i => { array = i; evt.Set (); }); buffer.LinkTo<int[]> (block); for (int i = 0; i < 9; i++) Assert.IsTrue (buffer.Post (i)); Assert.IsFalse (evt.Wait (100)); Assert.IsNull (array); Assert.IsTrue (buffer.Post (42)); Assert.IsTrue (evt.Wait (1000)); Assert.IsNotNull (array); CollectionAssert.AreEqual (new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 42 }, array); }