lib/rmega/pool.rb in rmega-0.0.6 vs lib/rmega/pool.rb in rmega-0.1.0
- old
+ new
@@ -1,14 +1,12 @@
require 'thread'
-class Thread
- # Helper to create a Pool instance.
- def self.pool(max)
- Pool.new(max)
- end
-
+module Rmega
class Pool
+ MAX = 5
+
def initialize(max)
+ max ||= MAX
Thread.abort_on_exception = true
@mutex = Mutex.new
@threads = Array.new(max)
end