Method: Concurrent::Future#execute
- Defined in:
- lib/concurrent-ruby/concurrent/future.rb
#execute ⇒ Future
Execute an :unscheduled Future. Immediately sets the state to :pending and passes the block to a new thread/thread pool for eventual execution. Does nothing if the Future is in any state other than :unscheduled.
53 54 55 56 57 58 |
# File 'lib/concurrent-ruby/concurrent/future.rb', line 53 def execute if compare_and_set_state(:pending, :unscheduled) @executor.post{ safe_execute(@task, @args) } self end end |