parallel 1.16.2 → 1.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/parallel.rb +13 -6
- data/lib/parallel/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6b2d803fd3a136456287d19f88a5986742beed7246f587491992661235e43c2
|
4
|
+
data.tar.gz: f3ed40c9c16f0a80e524f55c2f50d570d5da69c2f43ddc62023c323ddb968101
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5534907c40e98488528ed8c9bc08ae1eab61b5b8ec1ce9d1b02b40687d08a6f19f3721e962273674994654dbe7a55b8df05ff905342e0fb28ff810a6036d958
|
7
|
+
data.tar.gz: d0b9f65e4a85636f8b464605b9b53de89ff529139801a5f8a8c7259783bce45eb1791c43218ba9ec3950e04e00a14f40b38c6079b52375d1c50f34a8db16c109
|
data/lib/parallel.rb
CHANGED
@@ -201,13 +201,20 @@ module Parallel
|
|
201
201
|
|
202
202
|
class << self
|
203
203
|
def in_threads(options={:count => 2})
|
204
|
-
|
205
|
-
|
206
|
-
|
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)
|
data/lib/parallel/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2019-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email: michael@grosser.it
|