Method: Knj::Thread#initialize

Defined in:
lib/knj/thread.rb

#initialize(*args) ⇒ Thread

Initializes the thread and passes any given arguments to the thread-block.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/knj/thread.rb', line 6

def initialize(*args)
  raise "No block was given." unless block_given?
  
  super(*args) do
    begin
      yield(*args)
    rescue SystemExit, Interrupt
      raise
    rescue Exception => e
      print "#{Knj::Errors.error_str(e)}\n\n"
    end
  end
  
  @data = {}
end