Skip to content

Commit 24b7852

Browse files
authored
LimitedBarrier was renamed to Waiter (#231)
The guide was still talking about the LimitedBarrier even though it was renamed to Waiter.
1 parent 09bffd1 commit 24b7852

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

guides/asynchronous-tasks/readme.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,20 +143,23 @@ end
143143

144144
### Waiting for the First N Tasks
145145

146-
Occasionally, you may need to just wait for the first task (or first several tasks) to complete. You can use a combination of {ruby Async::LimitedBarrier} and {ruby Async::Barrier} for controlling this:
146+
Occasionally, you may need to just wait for the first task (or first several tasks) to complete. You can use a combination of {ruby Async::Waiter} and {ruby Async::Barrier} for controlling this:
147147

148148
```ruby
149-
barrier = Async::Barrier.new(parent: barrier)
149+
waiter = Async::Waiter.new(parent: barrier)
150150

151151
Async do
152152
jobs.each do |job|
153-
barrier.async do
153+
waiter.async do
154154
# ... process job ...
155155
end
156156
end
157157

158158
# Wait for the first two jobs to complete:
159-
done = barrier.wait(2)
159+
done = waiter.wait(2)
160+
161+
# You may use the barrier to stop the remaining jobs
162+
barrier.stop
160163
end
161164
```
162165

0 commit comments

Comments
 (0)