class XThreads
file: xthreads.rb
Public Class Methods
new()
click to toggle source
# File lib/xthreads.rb, line 7 def initialize() @threads = self end
Public Instance Methods
create_loop(name, options={}, &blk)
click to toggle source
# File lib/xthreads.rb, line 75 def create_loop(name, options={}, &blk) @threads[name] = XThread.new name, args=[], options, &blk @threads[name] end
create_thread(name, args, options={}, &blk)
click to toggle source
# File lib/xthreads.rb, line 80 def create_thread(name, args, options={}, &blk) #cleanup @threads[name] = XThread.new name, args, options.merge(interval: 0, loop: false), &blk @threads[name] end
Private Instance Methods
cleanup()
click to toggle source
Remove any dead threads
# File lib/xthreads.rb, line 90 def cleanup() @threads.each do |name, thread| @threads.delete name if thread.state == :dead end end