From: Clifford Heath Date: 2007-09-27T16:25:09+09:00 Subject: Deadlock falsely detected when using condition variables I have a fragment of multi-threaded code using Ruby's Mutex and ConditionVariable class, where it appears that the interpreter is calling a deadlock incorrectly. I'm using ruby 1.8.6 on Windows XP. The code in question looks like this: @mutex = Mutex.new @condition = ConditionVariable.new @mutex.synchronize { @condition.wait(@mutex) until @data_ready ... use data... @data_ready = false } And the producer thread says: @mutex.synchronize { ... make data available... @data_ready = true @condition.signal } Now sometimes the call to synchronize in the producer cause a deadlock, which shows the two threads to be both sleeping, one in the condition wait, one in the producer's synchronise call. This should never happen... the condition is meant to atomically release the mutex as it goes to sleep. Whats happening here folk? Clifford Heath.