Sha256: 802611d080c2f3bd3f35ec758af990a68cce82b95acc3a2949e0d7333fbec954
Contents?: true
Size: 590 Bytes
Versions: 5
Compression:
Stored size: 590 Bytes
Contents
module Plezi module EventMachine # A single worker. class Worker def initialize @stop = false wait = Worker.get_wait @thread = Thread.new { EventMachine.run wait until @stop } end def stop @instances = -1 @stop = true end def join stop @thread.join rescue true end def alive? @thread.alive? end def status @thread.status end def self.get_wait @primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37] @instances ||= -1 @instances += 1 if @instances < 7 @primes[@instances] / 10.0 end end end end
Version data entries
5 entries across 5 versions & 1 rubygems