CyclicBarrier

final class CyclicBarrier

A synchronization aid that allows a set of fibers to all wait for each other to reach a common barrier point.

CyclicBarriers are useful in programs involving a fixed sized party of fibers that must occasionally wait for each other. The barrier is called cyclic because it can be re-used after the waiting fibers are released.

A CyclicBarrier supports an optional action command that is run once per barrier point, after the last fiber in the party arrives, but before any fibers are released. This barrier action is useful for updating shared-state before any of the parties continue.

Companion:
object
class Object
trait Matchable
class Any

Value members

Concrete methods

The number of parties required to trip this barrier.

The number of parties required to trip this barrier.

Concrete fields

val await: IO[Unit, Int]

Waits until all parties have invoked await on this barrier. Fails if the barrier is broken.

Waits until all parties have invoked await on this barrier. Fails if the barrier is broken.

Queries if this barrier is in a broken state.

Queries if this barrier is in a broken state.

val reset: UIO[Unit]

Resets the barrier to its initial state. Breaks any waiting party.

Resets the barrier to its initial state. Breaks any waiting party.

The number of parties currently waiting at the barrier.

The number of parties currently waiting at the barrier.