class Concurrent::RubyExecutorService
@!macro abstract_executor_service_public_api @!visibility private
Public Class Methods
Source
# File lib/concurrent-ruby/concurrent/executor/ruby_executor_service.rb, line 11 def initialize(*args, &block) super @StopEvent = Event.new @StoppedEvent = Event.new end
Calls superclass method
Concurrent::AbstractExecutorService::new
Public Instance Methods
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
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
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
Source
# File lib/concurrent-ruby/concurrent/executor/ruby_executor_service.rb, line 64 def ns_running? !stop_event.set? end
Source
# File lib/concurrent-ruby/concurrent/executor/ruby_executor_service.rb, line 72 def ns_shutdown? stopped_event.set? end
Source
# File lib/concurrent-ruby/concurrent/executor/ruby_executor_service.rb, line 60 def ns_shutdown_execution stopped_event.set end
Source
# File lib/concurrent-ruby/concurrent/executor/ruby_executor_service.rb, line 68 def ns_shuttingdown? !(ns_running? || ns_shutdown?) end
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
Source
# File lib/concurrent-ruby/concurrent/executor/ruby_executor_service.rb, line 52 def stop_event @StopEvent end
Source
# File lib/concurrent-ruby/concurrent/executor/ruby_executor_service.rb, line 56 def stopped_event @StoppedEvent end