Created
April 5, 2010 11:46
-
-
Save deepak/356270 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
counter=0 | |
threads = [] | |
while true | |
t = Thread.new{ | |
sleeping = counter | |
puts "Sleeping for #{sleeping} seconds" | |
sleep sleeping | |
puts "Woke up from #{sleeping} seconds sleep" | |
} | |
threads << t | |
counter+=1 | |
break if counter>100 | |
end | |
threads.each {|t| t.join } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment