Created
June 22, 2011 06:15
-
-
Save wildjcrt/1039582 to your computer and use it in GitHub Desktop.
sleep_sort
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
#!/usr/bin/env ruby | |
# http://dis.4chan.org/read/prog/1295544154 | |
# Example: ./sleep_sort.rb 5 1 4 2 3 | |
def sleep_then_puts | |
puts sleep(ARGV.shift.to_i) | |
end | |
threads = [] | |
while !ARGV.empty? do | |
threads << Thread.new { sleep_then_puts } | |
end | |
threads.each {|thread| thread.join } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment