class Concurrent::MutexCountDownLatch
@!macro count_down_latch @!visibility private @!macro internal_implementation_note
Public Class Methods
Source
# File lib/concurrent-ruby/concurrent/atomic/mutex_count_down_latch.rb, line 12 def initialize(count = 1) Utility::NativeInteger.ensure_integer_and_bounds count Utility::NativeInteger.ensure_positive count super() synchronize { ns_initialize count } end
@!macro count_down_latch_method_initialize
Calls superclass method
Public Instance Methods
Source
# File lib/concurrent-ruby/concurrent/atomic/mutex_count_down_latch.rb, line 34 def count synchronize { @count } end
@!macro count_down_latch_method_count
Source
# File lib/concurrent-ruby/concurrent/atomic/mutex_count_down_latch.rb, line 26 def count_down synchronize do @count -= 1 if @count > 0 ns_broadcast if @count == 0 end end
@!macro count_down_latch_method_count_down
Source
# File lib/concurrent-ruby/concurrent/atomic/mutex_count_down_latch.rb, line 21 def wait(timeout = nil) synchronize { ns_wait_until(timeout) { @count == 0 } } end
@!macro count_down_latch_method_wait
Protected Instance Methods
Source
# File lib/concurrent-ruby/concurrent/atomic/mutex_count_down_latch.rb, line 40 def ns_initialize(count) @count = count end