You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Whether there are any tasks being held by the barrier.
58
-
# @returns [Boolean]
58
+
# @returns [Boolean] Whether there are any tasks being held by the barrier.
59
59
defempty?
60
60
@tasks.empty?
61
61
end
@@ -65,6 +65,7 @@ def empty?
65
65
# @yields {|task| ...} If a block is given, the unwaited task is yielded. You must invoke {Task#wait} yourself. In addition, you may `break` if you have captured enough results.
66
66
#
67
67
# @asynchronous Will wait for tasks to finish executing.
68
+
# @rbs () ?{(Task) -> untyped} -> void
68
69
defwait
69
70
while !@tasks.empty?
70
71
# Wait for a task to finish (we get the task node):
@@ -88,6 +89,7 @@ def wait
88
89
89
90
# Stop all tasks held by the barrier.
90
91
# @asynchronous May wait for tasks to finish executing.
Copy file name to clipboardExpand all lines: sig/async.rbs
+16-18Lines changed: 16 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -3,22 +3,20 @@ module Async
3
3
# A general purpose synchronisation primitive, which allows one task to wait for a number of other tasks to complete. It can be used in conjunction with {Semaphore}.
# Whether there are any tasks being held by the barrier.
15
13
publicdef empty?: () -> bool
16
14
17
15
# Wait for all tasks to complete by invoking {Task#wait} on each waiting task, which may raise an error. As long as the task has completed, it will be removed from the barrier.
18
-
publicdef wait: () { () -> void } -> untyped
16
+
publicdef wait: () ?{ (Task) -> untyped } -> void
19
17
20
18
# Stop all tasks held by the barrier.
21
-
publicdef stop: () -> untyped
19
+
publicdef stop: () -> void
22
20
end
23
21
24
22
# A convenient wrapper around the internal monotonic clock.
@@ -91,10 +89,10 @@ module Async
91
89
# A load balancing mechanism that can be used process work when the system is idle.
# Immediately terminate all children tasks, including transient tasks. Internally invokes `stop(false)` on all children. This should be considered a last ditch effort and is used when closing the scheduler.
257
255
publicdef terminate: () -> untyped
@@ -277,7 +275,7 @@ module Async
277
275
# It has a compatible interface with {Notification} and {Condition}, except that it's multi-value.
# Invoked when a fiber tries to perform a blocking operation which cannot continue. A corresponding call {unblock} must be performed to allow this fiber to continue.
# A composable synchronization primitive, which allows one task to wait for a number of other tasks to complete. It can be used in conjunction with {Semaphore} and/or {Barrier}.
0 commit comments