Subj : Re: Is there a deadlock or race condition here? To : comp.programming.threads From : David Schwartz Date : Thu Apr 14 2005 01:46 pm "Loic Domaigne" wrote in message news:3c7u23F6m3n1tU1@individual.net... > Hello, > > I'm definitively not an expert in that sort of things, > but shouldn't the len variable in > >> while(len == 0) >> produce.wait(); > > be read atomatically, with possibly a memory barrier before? It completely depends on what 'produce.wait()' does. And without knowing that, we can't really say if there are deadlocks or race conditions. If it's similar to a condition variable wait, then not even an atomic read or memory barrier will fix it. DS .