From: Eric Hodel Date: 2011-10-15T11:38:19+09:00 Subject: Re: deadlock producer consumer On Oct 14, 2011, at 5:42 PM, rubix Rubix wrote: > I keep having deadlock when executing it > > What is wrong with the code? I think may be I have to add an other > ConditionVariable, the problem is the producer and the consumer use the > two queues Is there any reason you're not using Queue? queue = Queue.new consumer = Thread.start do loop do queue.enq produce_value end end producer = Thread.start do loop do consume_value queue.deq end end