Method: Concurrent::Delay#wait
- Defined in:
- lib/concurrent-ruby/concurrent/delay.rb
#wait(timeout = nil) ⇒ Object
Note:
The default behavior of Delay is to block indefinitely when calling either value or wait, executing the delayed operation on the current thread. This makes the timeout value completely irrelevant. To enable non-blocking behavior, use the executor constructor option. This will cause the delayed operation to be execute on the given executor, allowing the call to timeout.
Return the value this object represents after applying the options specified by the #set_deref_options method.
132 133 134 135 136 137 138 139 140 |
# File 'lib/concurrent-ruby/concurrent/delay.rb', line 132 def wait(timeout = nil) if @executor execute_task_once super(timeout) else value end self end |