Method: AsyncCable::Util.create_task
- Defined in:
- lib/async_cable/util.rb
.create_task(parent = Async::Task.current?, schedule = false, &block) ⇒ Async::Task
Return created task.
6 7 8 9 10 11 12 13 14 |
# File 'lib/async_cable/util.rb', line 6 def create_task(parent = Async::Task.current?, schedule = false, &block) task = Async::Task.new(parent, &block) if schedule Async::Task.current.reactor << task.fiber else task.run end task end |