Class: XThreads

Inherits:
Hash
  • Object
show all
Defined in:
lib/xthreads.rb

Overview

file: xthreads.rb

Defined Under Namespace

Classes: XThread

Instance Method Summary collapse

Constructor Details

#initializeXThreads

Returns a new instance of XThreads.



7
8
9
# File 'lib/xthreads.rb', line 7

def initialize()
  @threads = self
end

Instance Method Details

#create_loop(name, options = {}, &blk) ⇒ Object



70
71
72
73
# File 'lib/xthreads.rb', line 70

def create_loop(name, options={}, &blk)
  @threads[name] = XThread.new name,  options, &blk
  @threads[name]
end

#create_thread(name, args, options = {}, &blk) ⇒ Object



75
76
77
78
79
# File 'lib/xthreads.rb', line 75

def create_thread(name, args, options={}, &blk)
  #cleanup
  @threads[name] = XThread.new name, args, options.merge(interval: 0, loop: false), &blk
  @threads[name]
end