Method: Concurrent::SingleThreadExecutor#wait_for_termination

Defined in:
lib/concurrent/executor/single_thread_executor.rb

#wait_for_termination(timeout = nil) ⇒ Boolean

Note:

Does not initiate shutdown or termination. Either shutdown or kill must be called before this method (or on another thread).

Block until executor shutdown is complete or until timeout seconds have passed.

Parameters:

  • timeout (Integer) (defaults to: nil)

    the maximum number of seconds to wait for shutdown to complete

Returns:

  • (Boolean)

    true if shutdown complete or false on timeout



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/concurrent/executor/single_thread_executor.rb', line 36

class SingleThreadExecutor < SingleThreadExecutorImplementation

  # @!macro [new] single_thread_executor_method_initialize
  #
  #   Create a new thread pool.
  #
  #   @option opts [Symbol] :fallback_policy (:discard) the policy for handling new
  #     tasks that are received when the queue size has reached
  #     `max_queue` or the executor has shut down
  #
  #   @raise [ArgumentError] if `:fallback_policy` is not one of the values specified
  #     in `FALLBACK_POLICIES`
  #
  #   @see http://docs.oracle.com/javase/tutorial/essential/concurrency/pools.html
  #   @see http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/Executors.html
  #   @see http://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ExecutorService.html

  # @!method initialize(opts = {})
  #   @!macro single_thread_executor_method_initialize
end