Skip to content

Instantly share code, notes, and snippets.

@daimatz
Created October 25, 2013 04:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daimatz/7149340 to your computer and use it in GitHub Desktop.
Save daimatz/7149340 to your computer and use it in GitHub Desktop.
Proc オブジェクトを単純に並列実行する例
f = Proc.new { puts "start f"; sleep 10; puts "end f" }
g = Proc.new { puts "start g"; sleep 5 ; puts "end g" }
puts "start"
[f, g].map{ |prc| Thread.new{ prc.call } }.map(&:join)
p Thread.list
puts "all end"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment