System.Threading.Barrier.SignalAndWait Method

Signals that a participant has reached the barrier and waits for all other participants to reach the barrier as well, using a 32-bit signed integer to measure the timeout, while observing a cancellation token.

Syntax

public bool SignalAndWait (int millisecondsTimeout, CancellationToken cancellationToken)

Parameters

millisecondsTimeout
The number of milliseconds to wait, or Timeout.Infinite(-1) to wait indefinitely.
cancellationToken
The System.Threading.CancellationToken to observe.

Returns

if all participants reached the barrier within the specified time; otherwise false

Remarks

If the cancellationToken was canceled before the signal took effect, then an OperationCanceledException is thrown and the Barrier.ParticipantsRemaining value is not decreased. If the cancellationToken is not canceled or is canceled after the signal takes effect then Barrier.ParticipantsRemaining is decreased and no OperationCanceledException is thrown.

Requirements

Namespace: System.Threading
Assembly: System (in System.dll)
Assembly Versions: 4.0.0.0