summaryrefslogtreecommitdiff
path: root/benchmark/vm_thread_queue.rb
blob: 1dd3696a3c846adabbd92a4b3755845aee7ec813 (plain)
123456789101112131415161718
require 'thread' n = 10_000_000 q = Thread::Queue.new consumer = Thread.new{ while q.pop # consuming end } producer = Thread.new{ n.times{ q.push true } q.push nil } consumer.join 
close