Class: LightIO::Library::ThreadGroup

Inherits:
Object
  • Object
show all
Includes:
Wrap::Wrapper
Defined in:
lib/lightio/library/thread.rb

Constant Summary collapse

Default =
ThreadGroup._wrap(::ThreadGroup::Default)

Instance Method Summary collapse

Methods included from Wrap::Wrapper

included, #initialize, #method_missing

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class LightIO::Wrap::Wrapper

Instance Method Details

#add(thread) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/lightio/library/thread.rb', line 12

def add(thread)
  if @io.enclosed?
    raise ThreadError, "can't move from the enclosed thread group"
  elsif thread.is_a?(LightIO::Library::Thread)
    # let thread decide how to add to group
    thread.send(:add_to_group, self)
  else
    @io.add(thread)
  end
  self
end

#listObject



24
25
26
# File 'lib/lightio/library/thread.rb', line 24

def list
  @io.list + threads
end