Module: Patch::Thread

Defined in:
lib/patch/thread.rb

Class Method Summary collapse

Class Method Details

.new(&block) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/patch/thread.rb', line 5

def self.new(&block)
  thread = ::Thread.new do
    begin
      yield
    rescue Exception => exception
      ::Thread.main.raise(exception)
    end
  end
  thread.abort_on_exception = true
  thread
end