parallel 1.5.0 → 1.5.1
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 +17 -14
- data/lib/parallel/version.rb +1 -1
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4485e35ba1d52d6b8267884c3371533ca3e76fdc
|
4
|
+
data.tar.gz: b6e4de966f97b0c09cbb8c561efc275de370bed2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e024ac38c60e101d73719bb368ef6ec482f7fac471dc2a72dfe0b760ec12e29f75864bd35d1e483ca478fe0e2a594e0cd021d046bf048aaea602ac334aaa9e59
|
7
|
+
data.tar.gz: fd4fa3446693012160debe76cc48a1abd0c1d80632b94cf2189b375e2202e8c5fec2af8dd4e689414b3fb399b25379edc8f890b2d472a4edfb5e6866a1b7f07f
|
data/lib/parallel.rb
CHANGED
@@ -125,23 +125,26 @@ module Parallel
|
|
125
125
|
# kill all these pids or threads if user presses Ctrl+c
|
126
126
|
def kill_on_ctrl_c(things, options)
|
127
127
|
return yield if RUBY_ENGINE == "jruby"
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
128
|
+
|
129
|
+
begin
|
130
|
+
@to_be_killed ||= []
|
131
|
+
old_interrupt = nil
|
132
|
+
signal = options.fetch(:interrupt_signal, INTERRUPT_SIGNAL)
|
133
|
+
|
134
|
+
if @to_be_killed.empty?
|
135
|
+
old_interrupt = trap_interrupt(signal) do
|
136
|
+
$stderr.puts 'Parallel execution interrupted, exiting ...'
|
137
|
+
@to_be_killed.flatten.compact.each { |thing| kill(thing) }
|
138
|
+
end
|
136
139
|
end
|
137
|
-
end
|
138
140
|
|
139
|
-
|
141
|
+
@to_be_killed << things
|
140
142
|
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
143
|
+
yield
|
144
|
+
ensure
|
145
|
+
@to_be_killed.pop # free threads for GC and do not kill pids that could be used for new processes
|
146
|
+
restore_interrupt(old_interrupt, signal) if @to_be_killed.empty?
|
147
|
+
end
|
145
148
|
end
|
146
149
|
|
147
150
|
def kill(thing)
|
data/lib/parallel/version.rb
CHANGED
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parallel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Grosser
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2015-05-25 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description:
|
13
|
+
description:
|
14
14
|
email: michael@grosser.it
|
15
15
|
executables: []
|
16
16
|
extensions: []
|
@@ -24,24 +24,24 @@ homepage: https://github.com/grosser/parallel
|
|
24
24
|
licenses:
|
25
25
|
- MIT
|
26
26
|
metadata: {}
|
27
|
-
post_install_message:
|
27
|
+
post_install_message:
|
28
28
|
rdoc_options: []
|
29
29
|
require_paths:
|
30
30
|
- lib
|
31
31
|
required_ruby_version: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
|
-
- -
|
33
|
+
- - ">="
|
34
34
|
- !ruby/object:Gem::Version
|
35
35
|
version: 1.9.3
|
36
36
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
requirements: []
|
42
|
-
rubyforge_project:
|
43
|
-
rubygems_version: 2.
|
44
|
-
signing_key:
|
42
|
+
rubyforge_project:
|
43
|
+
rubygems_version: 2.2.2
|
44
|
+
signing_key:
|
45
45
|
specification_version: 4
|
46
46
|
summary: Run any kind of code in parallel processes
|
47
47
|
test_files: []
|