Skip to content

Instantly share code, notes, and snippets.

@deepak
Created April 5, 2010 11:46
Show Gist options
  • Save deepak/356270 to your computer and use it in GitHub Desktop.
Save deepak/356270 to your computer and use it in GitHub Desktop.
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