Module: ZeevexConcurrency::ThreadPool::Stubs

Included in:
EventLoopAdapter, FixedPool, InlineThreadPool, ThreadPerJobPool
Defined in:
lib/zeevex_concurrency/thread_pool.rb

Instance Method Summary collapse

Instance Method Details

#backlogObject

how many tasks are waiting



48
49
50
# File 'lib/zeevex_concurrency/thread_pool.rb', line 48

def backlog
  0
end

#busy?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/zeevex_concurrency/thread_pool.rb', line 9

def busy?
  free_count == 0
end

#busy_countObject



17
18
19
# File 'lib/zeevex_concurrency/thread_pool.rb', line 17

def busy_count
  -1
end

#flushObject

flush any queued but un-executed tasks



28
29
30
# File 'lib/zeevex_concurrency/thread_pool.rb', line 28

def flush
  true
end

#free_countObject



21
22
23
# File 'lib/zeevex_concurrency/thread_pool.rb', line 21

def free_count
  (worker_count - busy_count)
end

#joinObject

Returns after all currently enqueued tasks complete - does not guarantee that tasks are not enqueued while waiting



36
37
38
39
40
41
42
43
# File 'lib/zeevex_concurrency/thread_pool.rb', line 36

def join
  latch = CountDownLatch.new(1)
  enqueue do
    latch.countdown!
  end
  latch.wait
  true
end

#worker_countObject



13
14
15
# File 'lib/zeevex_concurrency/thread_pool.rb', line 13

def worker_count
  -1
end