Class: ZeevexConcurrency::ThreadPool::FixedPool::HaltObject

Inherits:
Object
  • Object
show all
Defined in:
lib/zeevex_concurrency/thread_pool.rb

Instance Method Summary collapse

Constructor Details

#initialize(count) ⇒ HaltObject

Returns a new instance of HaltObject.



307
308
309
310
# File 'lib/zeevex_concurrency/thread_pool.rb', line 307

def initialize(count)
  @count = count
  @latch = CountDownLatch.new(count)
end

Instance Method Details

#halt!Object



312
313
314
315
316
# File 'lib/zeevex_concurrency/thread_pool.rb', line 312

def halt!
  # notify that we're now waiting
  @latch.countdown!
  @latch.wait
end

#waitObject



318
319
320
# File 'lib/zeevex_concurrency/thread_pool.rb', line 318

def wait
  @latch.wait
end