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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e5d9fe2eaa3012c11c39abb23dc7482ec2a224123ed4ef4424bb630b50f8d462
4
- data.tar.gz: 113adfafc25504e6f330f36dbd46707dc883e197c36d8530f0a58555ac55b8d4
3
+ metadata.gz: f8503897fe2c8f3b9593655310b259ee33d2a3774e65d7882524289286cea163
4
+ data.tar.gz: 952c6d1fd722b83efb95ffc3e4153c87d5925359aa403235f63496f984699588
5
5
  SHA512:
6
- metadata.gz: 973e99f9ff361ad1cdf62f074fd6897c6691304ea004dae58aece3309fddd713c5921bf02ff42bd748999f18e2ebf172bd1505a8af318e9cb5c70e23a858145c
7
- data.tar.gz: 88001bc4a38cd8a7fec4748ee89ee4b779c77eb925ed6e93923807fd57d4bc0227feffe43e54de55056c48b1705c1b551b1d26529525318d70a61986788919c0
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 in FIFO order.
53
+ # Wait for all tasks.
54
+ # @asynchronous Will wait for tasks to finish executing.
54
55
  def wait
55
- while task = @tasks.shift
56
- task.wait
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 task = @tasks.shift
62
- task.stop
63
- end
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
@@ -21,5 +21,5 @@
21
21
  # THE SOFTWARE.
22
22
 
23
23
  module Async
24
- VERSION = "1.30.0"
24
+ VERSION = "1.30.1"
25
25
  end
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.0
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-21 00:00:00.000000000 Z
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.2.22
182
+ rubygems_version: 3.0.3.1
183
183
  signing_key:
184
184
  specification_version: 4
185
185
  summary: A concurrency framework for Ruby.