Enables multiple tasks to cooperatively work on an algorithm in parallel through multiple phases.
Public Aliases | |
| using | post_phase_action |
| Represents the xtd::threading::barrier::post_phase_action delegate. | |
Public Constructors | |
| barrier (int32 participant_count) | |
| Initializes a new instance of the xtd::threading::barrier class. | |
| barrier (int32 participant_count, barrier::post_phase_action post_phase_action) | |
| Initializes a new instance of the xtd::threading::barrier class. | |
Public Properties | |
| int32 | current_phase_number () const |
| Gets the number of the barrier's current phase. | |
| int32 | participant_count () const |
| Gets the total number of participants in the barrier. | |
| int32 | participants_remaining () const |
| Gets the number of participants in the barrier that haven't yet signaled in the current phase. | |
Public Methods | |
| int32 | add_participant () |
| Notifies the xtd::threading::barrier that there will be an additional participant. | |
| int32 | add_participants (int32 participant_count) |
| Notifies the xtd::threading::barrier that there will be additional participants. | |
| void | close () |
| Close the current instance of the xtd::threading::barrier class. | |
| int32 | remove_participant () |
| Notifies the Barrier that there will be one less participant. | |
| int32 | remove_participants (int32 participant_count) |
| Notifies the Barrier that there will be fewer participants. | |
| void | signal_and_wait () |
| Signals that a participant has reached the barrier and waits for all other participants to reach the barrier as well. | |
| bool | signal_and_wait (int32 milliseconds_timeout) |
| 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. | |
| bool | signal_and_wait (const cancellation_token &cancellation_token) |
| Signals that a participant has reached the barrier and waits for all other participants to reach the barrier, while observing a cancellation token. | |
| bool | signal_and_wait (const time_span &timeout) |
| Signals that a participant has reached the barrier and waits for all other participants to reach the barrier as well, using a xtd::time_span object to measure the time interval. | |
| bool | signal_and_wait (int32 milliseconds_timeout, const cancellation_token &cancellation_token) |
| 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. | |
| bool | signal_and_wait (const time_span &timeout, const cancellation_token &cancellation_token) |
| Signals that a participant has reached the barrier and waits for all other participants to reach the barrier as well, using a xtd::time_span object to measure the time interval, while observing a cancellation token. | |
Additional Inherited Members | |
| object ()=default | |
| Create a new instance of the ultimate base class object. | |
| virtual bool | equals (const object &obj) const noexcept |
| Determines whether the specified object is equal to the current object. | |
| virtual xtd::size | get_hash_code () const noexcept |
| Serves as a hash function for a particular type. | |
| virtual type_object | get_type () const noexcept |
| Gets the type of the current instance. | |
| template<class object_t> | |
| xtd::unique_ptr_object< object_t > | memberwise_clone () const |
| Creates a shallow copy of the current object. | |
| virtual xtd::string | to_string () const noexcept |
| Returns a xtd::string that represents the current object. | |
| template<class object_a_t, class object_b_t> | |
| static bool | equals (const object_a_t &object_a, const object_b_t &object_b) noexcept |
| Determines whether the specified object instances are considered equal. | |
| template<class object_a_t, class object_b_t> | |
| static bool | reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept |
| Determines whether the specified object instances are the same instance. | |
Represents the xtd::threading::barrier::post_phase_action delegate.
|
explicit |
Initializes a new instance of the xtd::threading::barrier class.
| participant_count | The number of participating threads. |
| xtd::argument_out_of_range_exception | participant_count is less than 0 or greater than 32,767. |
| xtd::threading::barrier::barrier | ( | int32 | participant_count, |
| barrier::post_phase_action | post_phase_action ) |
Initializes a new instance of the xtd::threading::barrier class.
| participant_count | The number of participating threads. |
| post_phase_action | The xtd::action< barrier& > to be executed after each phase. Empty may be passed to indicate no action is taken. |
| xtd::argument_out_of_range_exception | participant_count is less than 0 or greater than 32,767. |
| int32 xtd::threading::barrier::current_phase_number | ( | ) | const |
Gets the number of the barrier's current phase.
| xtd::object_closed_exception | The current instance has already been disposed. |
| int32 xtd::threading::barrier::participant_count | ( | ) | const |
Gets the total number of participants in the barrier.
| xtd::object_closed_exception | The current instance has already been disposed. |
| int32 xtd::threading::barrier::participants_remaining | ( | ) | const |
Gets the number of participants in the barrier that haven't yet signaled in the current phase.
| xtd::object_closed_exception | The current instance has already been disposed. |
| int32 xtd::threading::barrier::add_participant | ( | ) |
Notifies the xtd::threading::barrier that there will be an additional participant.
| xtd::object_closed_exception | The current instance has already been disposed. |
| xtd::argument_out_of_range_exception | Adding a participant would cause the barrier's participant count to exceed 32,767. |
Notifies the xtd::threading::barrier that there will be additional participants.
| participant_count | The number of additional participants to add to the barrier. |
| xtd::object_closed_exception | The current instance has already been disposed. |
| xtd::argument_out_of_range_exception | participant_count is less than 0 -or- Adding participant_count participants would cause the barrier's participant count to exceed 32,767.. |
| void xtd::threading::barrier::close | ( | ) |
Close the current instance of the xtd::threading::barrier class.
| int32 xtd::threading::barrier::remove_participant | ( | ) |
Notifies the Barrier that there will be one less participant.
| xtd::object_closed_exception | The current instance has already been disposed. |
| xtd::argument_out_of_range_exception | The barrier already has 0 participants. |
Notifies the Barrier that there will be fewer participants.
| participant_count | The number of additional participants to remove from the barrier. |
| xtd::object_closed_exception | The current instance has already been disposed. |
| xtd::argument_out_of_range_exception | participant_count is less than 0 -or- The total participant count is less than the specified participant_count |
| void xtd::threading::barrier::signal_and_wait | ( | ) |
Signals that a participant has reached the barrier and waits for all other participants to reach the barrier as well.
| xtd::object_closed_exception | The current instance has already been disposed. |
| xtd::threading::barrier_post_phase_exception | If an exception is thrown from the post phase action of a xtd::threading::barrier after all participating threads have called xtd::threading::barrier::signal_and_wait, the exception will be wrapped in a xtd::threading::barrier_post_phase_exception and be thrown on all participating threads. |
| bool xtd::threading::barrier::signal_and_wait | ( | int32 | milliseconds_timeout | ) |
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.
| milliseconds_timeout | The number of milliseconds to wait, or xtd::threading::timeout::infinite(-1) to wait indefinitely. |
true if all participants reached the barrier within the specified time; otherwise false. | xtd::argument_out_of_range_exception | milliseconds_timeout is a negative number other than -1, which represents an infinite time-out. |
| xtd::object_closed_exception | The current instance has already been disposed. |
| xtd::threading::barrier_post_phase_exception | If an exception is thrown from the post phase action of a xtd::threading::barrier after all participating threads have called xtd::threading::barrier::signal_and_wait, the exception will be wrapped in a xtd::threading::barrier_post_phase_exception and be thrown on all participating threads. |
| bool xtd::threading::barrier::signal_and_wait | ( | const cancellation_token & | cancellation_token | ) |
Signals that a participant has reached the barrier and waits for all other participants to reach the barrier, while observing a cancellation token.
| cancellation_token | The xtd::threading::cancellation_token to observe. |
true if all participants reached the barrier within the specified time; otherwise false. | xtd::operation_canceled_exception | cancellation_token has been canceled. |
| xtd::object_closed_exception | The current instance has already been disposed. |
| xtd::threading::barrier_post_phase_exception | If an exception is thrown from the post phase action of a xtd::threading::barrier after all participating threads have called xtd::threading::barrier::signal_and_wait, the exception will be wrapped in a xtd::threading::barrier_post_phase_exception and be thrown on all participating threads. |
| bool xtd::threading::barrier::signal_and_wait | ( | const time_span & | timeout | ) |
Signals that a participant has reached the barrier and waits for all other participants to reach the barrier as well, using a xtd::time_span object to measure the time interval.
| timout | A xtd::time_span that represents the number of milliseconds to wait, or a xtd::time_span that represents -1 milliseconds to wait indefinitely. |
true if all participants reached the barrier within the specified time; otherwise false. | xtd::argument_out_of_range_exception | milliseconds_timeout is a negative number other than -1, which represents an infinite time-out. |
| xtd::object_closed_exception | The current instance has already been disposed. |
| xtd::threading::barrier_post_phase_exception | If an exception is thrown from the post phase action of a xtd::threading::barrier after all participating threads have called xtd::threading::barrier::signal_and_wait, the exception will be wrapped in a xtd::threading::barrier_post_phase_exception and be thrown on all participating threads. |
| bool xtd::threading::barrier::signal_and_wait | ( | int32 | milliseconds_timeout, |
| const cancellation_token & | cancellation_token ) |
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.
| milliseconds_timeout | The number of milliseconds to wait, or xtd::threading::timeout::infinite(-1) to wait indefinitely. |
| cancellation_token | The xtd::threading::cancellation_token to observe. |
true if all participants reached the barrier within the specified time; otherwise false. | xtd::argument_out_of_range_exception | milliseconds_timeout is a negative number other than -1, which represents an infinite time-out. |
| xtd::operation_canceled_exception | cancellation_token has been canceled. |
| xtd::object_closed_exception | The current instance has already been disposed. |
| xtd::threading::barrier_post_phase_exception | If an exception is thrown from the post phase action of a xtd::threading::barrier after all participating threads have called xtd::threading::barrier::signal_and_wait, the exception will be wrapped in a xtd::threading::barrier_post_phase_exception and be thrown on all participating threads. |
| bool xtd::threading::barrier::signal_and_wait | ( | const time_span & | timeout, |
| const cancellation_token & | cancellation_token ) |
Signals that a participant has reached the barrier and waits for all other participants to reach the barrier as well, using a xtd::time_span object to measure the time interval, while observing a cancellation token.
| timout | A xtd::time_span that represents the number of milliseconds to wait, or a xtd::time_span that represents -1 milliseconds to wait indefinitely. |
| cancellation_token | The xtd::threading::cancellation_token to observe. |
true if all participants reached the barrier within the specified time; otherwise false. | xtd::argument_out_of_range_exception | milliseconds_timeout is a negative number other than -1, which represents an infinite time-out. |
| xtd::operation_canceled_exception | cancellation_token has been canceled. |
| xtd::object_closed_exception | The current instance has already been disposed. |
| xtd::threading::barrier_post_phase_exception | If an exception is thrown from the post phase action of a xtd::threading::barrier after all participating threads have called xtd::threading::barrier::signal_and_wait, the exception will be wrapped in a xtd::threading::barrier_post_phase_exception and be thrown on all participating threads. |