Barrier.SignalAndWait Method

Definition

Signals that a participant has reached the barrier and waits for all other participants to reach the barrier as well.

Overloads

SignalAndWait()

Signals that a participant has reached the barrier and waits for all other participants to reach the barrier as well.

SignalAndWait(Int32)

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.

SignalAndWait(CancellationToken)

Signals that a participant has reached the barrier and waits for all other participants to reach the barrier, while observing a cancellation token.

SignalAndWait(TimeSpan)

Signals that a participant has reached the barrier and waits for all other participants to reach the barrier as well, using a TimeSpan object to measure the time interval.

SignalAndWait(Int32, CancellationToken)

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.

SignalAndWait(TimeSpan, CancellationToken)

Signals that a participant has reached the barrier and waits for all other participants to reach the barrier as well, using a TimeSpan object to measure the time interval, while observing a cancellation token.

SignalAndWait()

Signals that a participant has reached the barrier and waits for all other participants to reach the barrier as well.

public:
 void SignalAndWait();
public void SignalAndWait ();
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public void SignalAndWait ();
member this.SignalAndWait : unit -> unit
[<System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
member this.SignalAndWait : unit -> unit
Public Sub SignalAndWait ()
Attributes

Exceptions

The current instance has already been disposed.

The method was invoked from within a post-phase action, the barrier currently has 0 participants, or the barrier is signaled by more threads than are registered as participants.

If an exception is thrown from the post phase action of a Barrier after all participating threads have called SignalAndWait, the exception will be wrapped in a BarrierPostPhaseException and be thrown on all participating threads.

See also

Applies to

SignalAndWait(Int32)

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.

public:
 bool SignalAndWait(int millisecondsTimeout);
public bool SignalAndWait (int millisecondsTimeout);
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public bool SignalAndWait (int millisecondsTimeout);
member this.SignalAndWait : int -> bool
[<System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
member this.SignalAndWait : int -> bool
Public Function SignalAndWait (millisecondsTimeout As Integer) As Boolean

Parameters

millisecondsTimeout
Int32

The number of milliseconds to wait, or Infinite(-1) to wait indefinitely.

Returns

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

Attributes

Exceptions

The current instance has already been disposed.

millisecondsTimeout is a negative number other than -1, which represents an infinite time-out.

The method was invoked from within a post-phase action, the barrier currently has 0 participants, or the barrier is signaled by more threads than are registered as participants.

If an exception is thrown from the post phase action of a Barrier after all participating threads have called SignalAndWait, the exception will be wrapped in a BarrierPostPhaseException and be thrown on all participating threads.

See also

Applies to

SignalAndWait(CancellationToken)

Signals that a participant has reached the barrier and waits for all other participants to reach the barrier, while observing a cancellation token.

public:
 void SignalAndWait(System::Threading::CancellationToken cancellationToken);
public void SignalAndWait (System.Threading.CancellationToken cancellationToken);
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public void SignalAndWait (System.Threading.CancellationToken cancellationToken);
member this.SignalAndWait : System.Threading.CancellationToken -> unit
[<System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
member this.SignalAndWait : System.Threading.CancellationToken -> unit
Public Sub SignalAndWait (cancellationToken As CancellationToken)

Parameters

cancellationToken
CancellationToken

The CancellationToken to observe.

Attributes

Exceptions

cancellationToken has been canceled.

The current instance has already been disposed.

The method was invoked from within a post-phase action, the barrier currently has 0 participants, or the barrier is signaled by more threads than are registered as participants.

See also

Applies to

SignalAndWait(TimeSpan)

Signals that a participant has reached the barrier and waits for all other participants to reach the barrier as well, using a TimeSpan object to measure the time interval.

public:
 bool SignalAndWait(TimeSpan timeout);
public bool SignalAndWait (TimeSpan timeout);
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public bool SignalAndWait (TimeSpan timeout);
member this.SignalAndWait : TimeSpan -> bool
[<System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
member this.SignalAndWait : TimeSpan -> bool
Public Function SignalAndWait (timeout As TimeSpan) As Boolean

Parameters

timeout
TimeSpan

A TimeSpan that represents the number of milliseconds to wait, or a TimeSpan that represents -1 milliseconds to wait indefinitely.

Returns

true if all other participants reached the barrier; otherwise, false.

Attributes

Exceptions

The current instance has already been disposed.

timeout is a negative number other than -1 milliseconds, which represents an infinite time-out, or it is greater than 32,767.

The method was invoked from within a post-phase action, the barrier currently has 0 participants, or the barrier is signaled by more threads than are registered as participants.

See also

Applies to

SignalAndWait(Int32, CancellationToken)

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.

public:
 bool SignalAndWait(int millisecondsTimeout, System::Threading::CancellationToken cancellationToken);
public bool SignalAndWait (int millisecondsTimeout, System.Threading.CancellationToken cancellationToken);
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public bool SignalAndWait (int millisecondsTimeout, System.Threading.CancellationToken cancellationToken);
member this.SignalAndWait : int * System.Threading.CancellationToken -> bool
[<System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
member this.SignalAndWait : int * System.Threading.CancellationToken -> bool
Public Function SignalAndWait (millisecondsTimeout As Integer, cancellationToken As CancellationToken) As Boolean

Parameters

millisecondsTimeout
Int32

The number of milliseconds to wait, or Infinite(-1) to wait indefinitely.

cancellationToken
CancellationToken

The CancellationToken to observe.

Returns

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

Attributes

Exceptions

cancellationToken has been canceled.

The current instance has already been disposed.

millisecondsTimeout is a negative number other than -1, which represents an infinite time-out.

The method was invoked from within a post-phase action, the barrier currently has 0 participants, or the barrier is signaled by more threads than are registered as participants.

Remarks

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

See also

Applies to

SignalAndWait(TimeSpan, CancellationToken)

Signals that a participant has reached the barrier and waits for all other participants to reach the barrier as well, using a TimeSpan object to measure the time interval, while observing a cancellation token.

public:
 bool SignalAndWait(TimeSpan timeout, System::Threading::CancellationToken cancellationToken);
public bool SignalAndWait (TimeSpan timeout, System.Threading.CancellationToken cancellationToken);
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public bool SignalAndWait (TimeSpan timeout, System.Threading.CancellationToken cancellationToken);
member this.SignalAndWait : TimeSpan * System.Threading.CancellationToken -> bool
[<System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
member this.SignalAndWait : TimeSpan * System.Threading.CancellationToken -> bool
Public Function SignalAndWait (timeout As TimeSpan, cancellationToken As CancellationToken) As Boolean

Parameters

timeout
TimeSpan

A TimeSpan that represents the number of milliseconds to wait, or a TimeSpan that represents -1 milliseconds to wait indefinitely.

cancellationToken
CancellationToken

The CancellationToken to observe.

Returns

true if all other participants reached the barrier; otherwise, false.

Attributes

Exceptions

cancellationToken has been canceled.

The current instance has already been disposed.

timeout is a negative number other than -1 milliseconds, which represents an infinite time-out.

The method was invoked from within a post-phase action, the barrier currently has 0 participants, or the barrier is signaled by more threads than are registered as participants.

See also

Applies to