parallel 0.3.2 → 0.3.3
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.
- data/VERSION +1 -1
- data/lib/parallel.rb +5 -13
- data/parallel.gemspec +1 -1
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
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
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
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