Class: Ruined::Thread

Inherits:
Object
  • Object
show all
Defined in:
lib/ruined/ruinmain.rb

Class Method Summary collapse

Class Method Details

._original_startObject



23
# File 'lib/ruined/ruinmain.rb', line 23

alias :_original_start :start

.start(&proc) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/ruined/ruinmain.rb', line 24

def start(&proc)
  webrick = caller.first.include?('webrick')
  $stderr.puts "caller=#{caller[2]}, webrick=#{webrick}"
  $stderr.flush
  _original_start do
    Ruined.add_unbreakable(Thread.current) if webrick
    begin
      proc.call
    ensure
      Ruined.remove_unbreakable(Thread.current) if webrick    
    end
  end  
end