Skip to content

Instantly share code, notes, and snippets.

@ha1t
Created October 21, 2011 09:21
Show Gist options
  • Save ha1t/1303429 to your computer and use it in GitHub Desktop.
Save ha1t/1303429 to your computer and use it in GitHub Desktop.
ruby thread example
puts "Test start"
puts "Create thread"
message = ARGV[0] ||= '0'
begin
t = Thread.new do
puts "Start thread"
begin
raise "chatched"
rescue => t_ex
p message + t_ex.message
end
puts "End thread"
end
rescue => ex
p ex.message
end
puts "Waiting for the thread to complete"
t.join
puts "Test compleated"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment