parallel 1.16.2 → 1.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8b37ab79cd4bc5553a9663242658e3ebe5176b012ab8249507769cdd033a1647
4
- data.tar.gz: e2cd38e24a3599200c0ed28e18ad1a7892d6f9f44b1d4745e0f94f65efd16339
3
+ metadata.gz: a6b2d803fd3a136456287d19f88a5986742beed7246f587491992661235e43c2
4
+ data.tar.gz: f3ed40c9c16f0a80e524f55c2f50d570d5da69c2f43ddc62023c323ddb968101
5
5
  SHA512:
6
- metadata.gz: dbe5f61e9cb9c58d6a4e3c415d52943fbcff5ecc184a56ed1b0732806b6aea79276dacbf602c5bdadcdfafcdbab64e2c12cc9b8d04a7c6c7c889b9f501b519df
7
- data.tar.gz: e6349716635198a4c33830d1f4812bb84a7d32116ecfde98471808fe475ecae8231485d26e56282cae6b58b85fb0d604ef88eea04ef84b58be8dbbe8b416a564
6
+ metadata.gz: b5534907c40e98488528ed8c9bc08ae1eab61b5b8ec1ce9d1b02b40687d08a6f19f3721e962273674994654dbe7a55b8df05ff905342e0fb28ff810a6036d958
7
+ data.tar.gz: d0b9f65e4a85636f8b464605b9b53de89ff529139801a5f8a8c7259783bce45eb1791c43218ba9ec3950e04e00a14f40b38c6079b52375d1c50f34a8db16c109
@@ -201,13 +201,20 @@ module Parallel
201
201
 
202
202
  class << self
203
203
  def in_threads(options={:count => 2})
204
- count, _ = extract_count_from_options(options)
205
- threads = Array.new(count) do |i|
206
- Thread.new { yield(i) }
204
+ Thread.handle_interrupt(Exception => :never) do
205
+ begin
206
+ threads = []
207
+ count, _ = extract_count_from_options(options)
208
+ count.times do |i|
209
+ threads << Thread.new { yield(i) }
210
+ end
211
+ Thread.handle_interrupt(Exception => :immediate) do
212
+ threads.map(&:value)
213
+ end
214
+ ensure
215
+ threads.each(&:kill)
216
+ end
207
217
  end
208
- threads.map(&:value)
209
- ensure
210
- threads.each(&:kill)
211
218
  end
212
219
 
213
220
  def in_processes(options = {}, &block)
@@ -1,3 +1,3 @@
1
1
  module Parallel
2
- VERSION = Version = '1.16.2'
2
+ VERSION = Version = '1.17.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parallel
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.16.2
4
+ version: 1.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-29 00:00:00.000000000 Z
11
+ date: 2019-04-01 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: michael@grosser.it