Skip to content

Instantly share code, notes, and snippets.

@elskwid
Created February 16, 2013 01:24
Show Gist options
  • Save elskwid/4964994 to your computer and use it in GitHub Desktop.
Save elskwid/4964994 to your computer and use it in GitHub Desktop.
Small example of Queue
require 'thread'
q = Queue.new
(0..1000).each{ |i| q << i }
puts q.length
Thread.new do
sleep 1
puts "FIRST #{q.pop}"
end
Thread.new do
loop do
sleep 1
puts "SECOND #{q.pop}"
end
end
sleep 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment