Sha256: 9787c384414f56061697f7161f3f71171ecb6da68210bc87591801d09262333e
Contents?: true
Size: 516 Bytes
Versions: 2
Compression:
Stored size: 516 Bytes
Contents
module M2R class MultithreadHandler attr_reader :threads def initialize(singlethread_handler_factory) @singlethread_handler_factory = singlethread_handler_factory end def listen @threads = 8.times.map do Thread.new do handler = @singlethread_handler_factory.new Thread.current[:m2r_handler] = handler handler.listen end end end def stop @threads.each do |t| t[:m2r_handler].stop end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
m2r-2.1.0 | lib/m2r/multithread_handler.rb |
m2r-2.1.0.pre | lib/m2r/multithread_handler.rb |