class Concurrent::IndirectImmediateExecutor
@note Intended for use primarily in testing and debugging.
inconsistent with how it would behave for a threaded executor.
overflow the single stack in case of an ImmediateExecutor, which is
more operations on the same executor and so on - such a situation might
thread at its disposal. This can be helpful when the operations will spawn
ImmediateExecutor works, but the operation has the full stack of the new
current thread until the operation is complete. This is similar to how the
immediately runs every ‘#post` operation on a new thread, blocking the
This executor service exists mainly for testing an debugging. When used it
and no two operations can be performed simultaneously.
until it completes. Operations are performed in the order they are received
An executor service which runs all operations on a new thread, blocking
def initialize
def initialize super @internal_executor = SimpleExecutorService.new end
def post(*args, &task)
def post(*args, &task) raise ArgumentError.new("no block given") unless block_given? return false unless running? event = Concurrent::Event.new @internal_executor.post do begin task.call(*args) ensure event.set end end event.wait true end