class Concurrent::RubyExecutorService
@!macro abstract_executor_service_public_api @!visibility private
Public Class Methods
new(*args, &block)
click to toggle source
Calls superclass method
Concurrent::AbstractExecutorService.new
# File lib/concurrent-ruby/concurrent/executor/ruby_executor_service.rb, line 11 def initialize(*args, &block) super @StopEvent = Event.new @StoppedEvent = Event.new end
Public Instance Methods
kill()
click to toggle source
# File lib/concurrent-ruby/concurrent/executor/ruby_executor_service.rb, line 36 def kill synchronize do break if shutdown? stop_event.set ns_kill_execution stopped_event.set end true end
shutdown()
click to toggle source
# File lib/concurrent-ruby/concurrent/executor/ruby_executor_service.rb, line 27 def shutdown synchronize do break unless running? stop_event.set ns_shutdown_execution end true end
wait_for_termination(timeout = nil)
click to toggle source
# File lib/concurrent-ruby/concurrent/executor/ruby_executor_service.rb, line 46 def wait_for_termination(timeout = nil) stopped_event.wait(timeout) end
Private Instance Methods
ns_running?()
click to toggle source
# File lib/concurrent-ruby/concurrent/executor/ruby_executor_service.rb, line 64 def ns_running? !stop_event.set? end
ns_shutdown?()
click to toggle source
# File lib/concurrent-ruby/concurrent/executor/ruby_executor_service.rb, line 72 def ns_shutdown? stopped_event.set? end
ns_shutdown_execution()
click to toggle source
# File lib/concurrent-ruby/concurrent/executor/ruby_executor_service.rb, line 60 def ns_shutdown_execution stopped_event.set end
ns_shuttingdown?()
click to toggle source
# File lib/concurrent-ruby/concurrent/executor/ruby_executor_service.rb, line 68 def ns_shuttingdown? !(ns_running? || ns_shutdown?) end
post(*args, &task)
click to toggle source
# File lib/concurrent-ruby/concurrent/executor/ruby_executor_service.rb, line 17 def post(*args, &task) raise ArgumentError.new('no block given') unless block_given? synchronize do # If the executor is shut down, reject this task return handle_fallback(*args, &task) unless running? ns_execute(*args, &task) true end end
stop_event()
click to toggle source
# File lib/concurrent-ruby/concurrent/executor/ruby_executor_service.rb, line 52 def stop_event @StopEvent end
stopped_event()
click to toggle source
# File lib/concurrent-ruby/concurrent/executor/ruby_executor_service.rb, line 56 def stopped_event @StoppedEvent end