Sha256: 8137b1e5fb11e104ffe1f03e387810be34beae5a4ccda8d488502dd4d0d035b9
Contents?: true
Size: 556 Bytes
Versions: 8
Compression:
Stored size: 556 Bytes
Contents
module WatCatcher class Backgrounder def initialize @queue = Queue.new background_thread at_exit do @queue << false background_thread.join() end end def queue &block p "queueing" @queue << block end def background_thread @thread ||= Thread.new do running = true while running || !@queue.empty? msg = @queue.pop if msg msg.call else running = false end end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems