async 1.30.0 → 1.30.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/async/barrier.rb +15 -6
- data/lib/async/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8503897fe2c8f3b9593655310b259ee33d2a3774e65d7882524289286cea163
|
4
|
+
data.tar.gz: 952c6d1fd722b83efb95ffc3e4153c87d5925359aa403235f63496f984699588
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b6c1a440279e389c4750ac7b7b716d19f05e31b29c67e3b712692b54877dca265eff31994d9a9220a1be7fa44fc79622f244a188e470e46f4a52b343e8b7638
|
7
|
+
data.tar.gz: 1c33f438780355d349dbe78ea0706cfcdc4165f3f402aae26042414f01a975e20a1f244621ca1486c36d10877b7b4d825a4c0aed6ef6a3a69dc0a41c1cd38ace
|
data/lib/async/barrier.rb
CHANGED
@@ -50,17 +50,26 @@ module Async
|
|
50
50
|
@tasks.empty?
|
51
51
|
end
|
52
52
|
|
53
|
-
# Wait for tasks
|
53
|
+
# Wait for all tasks.
|
54
|
+
# @asynchronous Will wait for tasks to finish executing.
|
54
55
|
def wait
|
55
|
-
|
56
|
-
|
56
|
+
# TODO: This would be better with linked list.
|
57
|
+
while @tasks.any?
|
58
|
+
task = @tasks.first
|
59
|
+
|
60
|
+
begin
|
61
|
+
task.wait
|
62
|
+
ensure
|
63
|
+
# Remove the task from the waiting list if it's finished:
|
64
|
+
@tasks.shift if @tasks.first == task
|
65
|
+
end
|
57
66
|
end
|
58
67
|
end
|
59
68
|
|
60
69
|
def stop
|
61
|
-
while
|
62
|
-
|
63
|
-
|
70
|
+
# We have to be careful to avoid enumerating tasks while adding/removing to it:
|
71
|
+
tasks = @tasks.dup
|
72
|
+
tasks.each(&:stop)
|
64
73
|
end
|
65
74
|
end
|
66
75
|
end
|
data/lib/async/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: async
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.30.
|
4
|
+
version: 1.30.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-07-
|
11
|
+
date: 2021-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: console
|
@@ -179,7 +179,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: '0'
|
181
181
|
requirements: []
|
182
|
-
rubygems_version: 3.
|
182
|
+
rubygems_version: 3.0.3.1
|
183
183
|
signing_key:
|
184
184
|
specification_version: 4
|
185
185
|
summary: A concurrency framework for Ruby.
|