Sha256: 942349954ebf0f0d94078f433e2fa928c3881f7f5d1ca32fee04a62fdbae698c

Contents?: true

Size: 595 Bytes

Versions: 2

Compression:

Stored size: 595 Bytes

Contents

#          Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com
# All files in this distribution are subject to the terms of the Ruby license.

module Ramaze
  module Helper::Thread
    ##
    # The thread method executes the specified block in a new thread.
    #
    # @param [Block] block The block that contains the code that will be executed in the new thread.
    #
    def thread &block
      parent_thread = Thread.current
      Thread.new do
        begin
          block.call
        rescue Exception => e
          parent_thread.raise(e)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ramaze-2011.01.30 lib/ramaze/helper/thread.rb
ramaze-2011.01 lib/ramaze/helper/thread.rb