parallel 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/lib/parallel.rb +5 -13
  3. data/parallel.gemspec +1 -1
  4. metadata +1 -1
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.2
1
+ 0.3.3
data/lib/parallel.rb CHANGED
@@ -34,22 +34,14 @@ class Parallel
34
34
  # Collect results from pipes simultanously
35
35
  # otherwise pipes get stuck when to much is written (buffer full)
36
36
  out = []
37
- collectors = []
38
- count.times do |i|
39
- collectors << Thread.new do
40
- writes[i].close
41
-
42
- out[i] = ''
43
- while text = reads[i].gets
44
- out[i] += text
45
- end
46
-
47
- reads[i].close
37
+ in_threads(count) do |i|
38
+ writes[i].close
39
+ while text = reads[i].gets
40
+ out[i] = out[i].to_s + text
48
41
  end
42
+ reads[i].close
49
43
  end
50
44
 
51
- collectors.each{|c| c.join }
52
-
53
45
  out.map{|x| Marshal.load(x) } # Deserialize results
54
46
  end
55
47
 
data/parallel.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{parallel}
8
- s.version = "0.3.2"
8
+ s.version = "0.3.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Michael Grosser"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parallel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser