Skip to content

Instantly share code, notes, and snippets.

@wildjcrt
Created June 22, 2011 06:15
Show Gist options
  • Save wildjcrt/1039582 to your computer and use it in GitHub Desktop.
Save wildjcrt/1039582 to your computer and use it in GitHub Desktop.
sleep_sort
#!/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