Method: Concurrent::Future#execute
- Defined in:
- lib/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`.
50 51 52 53 54 55 |
# File 'lib/concurrent/future.rb', line 50 def execute if compare_and_set_state(:pending, :unscheduled) @executor.post{ safe_execute(@task, @args) } self end end |