Method: Concurrent::CyclicBarrier#initialize

Defined in:
lib/concurrent-ruby/concurrent/atomic/cyclic_barrier.rb

#initialize(parties) { ... } ⇒ CyclicBarrier

Create a new ‘CyclicBarrier` that waits for `parties` threads

Yields:

  • an optional block that will be executed that will be executed after the last thread arrives and before the others are released

Raises:

  • if ‘parties` is not an integer or is less than zero



40
41
42
43
44
45
46
# File 'lib/concurrent-ruby/concurrent/atomic/cyclic_barrier.rb', line 40

def initialize(parties, &block)
  Utility::NativeInteger.ensure_integer_and_bounds parties
  Utility::NativeInteger.ensure_positive_and_no_zero parties

  super(&nil)
  synchronize { ns_initialize parties, &block }
end