Class: ZeevexConcurrency::ThreadPool::EventLoopAdapter
- Inherits:
-
Object
- Object
- ZeevexConcurrency::ThreadPool::EventLoopAdapter
show all
- Includes:
- Stubs
- Defined in:
- lib/zeevex_concurrency/thread_pool.rb
Overview
Use a single-threaded event loop to process jobs
Instance Method Summary
collapse
Methods included from Stubs
#busy?, #busy_count, #free_count, #join, #worker_count
Constructor Details
Returns a new instance of EventLoopAdapter.
66
67
68
69
|
# File 'lib/zeevex_concurrency/thread_pool.rb', line 66
def initialize(loop = nil)
@loop ||= ZeevexConcurrency::EventLoop.new
start
end
|
Instance Method Details
#backlog ⇒ Object
88
89
90
|
# File 'lib/zeevex_concurrency/thread_pool.rb', line 88
def backlog
@loop.backlog
end
|
#enqueue(callable = nil, &block) ⇒ Object
79
80
81
|
# File 'lib/zeevex_concurrency/thread_pool.rb', line 79
def enqueue(callable = nil, &block)
@loop.enqueue _check_args(callable, block)
end
|
#flush ⇒ Object
83
84
85
86
|
# File 'lib/zeevex_concurrency/thread_pool.rb', line 83
def flush
@loop.flush
true
end
|
#start ⇒ Object
71
72
73
|
# File 'lib/zeevex_concurrency/thread_pool.rb', line 71
def start
@loop.start
end
|
#stop ⇒ Object
75
76
77
|
# File 'lib/zeevex_concurrency/thread_pool.rb', line 75
def stop
@loop.stop
end
|