Method: Async::Semaphore#async
- Defined in:
- lib/async/semaphore.rb
#async(*arguments, parent: (@parent or Task.current), **options) ⇒ Object
Run an async task. Will wait until the semaphore is ready until spawning and running the task.
61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/async/semaphore.rb', line 61 def async(*arguments, parent: (@parent or Task.current), **) wait parent.async(**) do |task| @count += 1 begin yield task, *arguments ensure self.release end end end |