Wait() public method

Blocks the current thread until it can enter the NonReentrantLock, while observing a T:System.Threading.CancellationToken.
Recursive locking is not supported. i.e. A thread may not call Wait successfully twice without an intervening Release.
was /// canceled. The caller already holds the lock
public Wait ( CancellationToken cancellationToken = default(CancellationToken) ) : void
cancellationToken System.Threading.CancellationToken The token to /// observe.
return void
示例#1
0
 public static SemaphoreDisposer DisposableWait(this NonReentrantLock semaphore, CancellationToken cancellationToken = default(CancellationToken))
 {
     semaphore.Wait(cancellationToken);
     return(new SemaphoreDisposer(semaphore));
 }
示例#2
0
 private WaitThatValidatesInvariants TakeLock(CancellationToken cancellationToken)
 {
     s_gate.Wait(cancellationToken);
     AssertInvariants_NoLock();
     return(new WaitThatValidatesInvariants(this));
 }