Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Chunky_bacon
- def sizzle
- puts "I'm sizzling, eat me"
- end
- end
- chunky_bacon = Chunky_bacon.new
- chunky_bacon_queue = Queue.new
- chunky_bacon_queue << chunky_bacon
- 5.times.map do
- Thread.new do
- begin
- chunky_bacon = chunky_bacon_queue.pop(true)
- chunky_bacon.sizzle!
- end
- end.each(&:join)
- =====
- #This is happening 5x. But for starters, doesn't there have to be 5 objects added to the queue for it to work? Seems like there are 5 items "popped" out of the queue, but not 5 going in.
Advertisement
Add Comment
Please, Sign In to add comment