Sha256: 988bdde9528750c9f12cde3a1a0823c9b585072f38d9c19fb095ada019ec5b73
Contents?: true
Size: 633 Bytes
Versions: 1
Compression:
Stored size: 633 Bytes
Contents
module Sideband class Thread attr_reader :thread def initialize(manager) @thread = ::Thread.new do queue = manager.queue while true work = queue.pop if work.nil? break # break from the infinite loop when a work of nil is pushed else begin work.call rescue Exception # Sideband will ignore all Exceptions, # better to handle in your workers. end end end end end def join thread.join end def kill thread.kill end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sideband-1.0.4 | lib/sideband/thread.rb |