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



66
67
68
69
# File 'lib/xthreads.rb', line 66

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

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



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

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