"H . J . Lu" <hjl@lucon.org> writes: > Here is a modified ex2.c which only uses one conditional variable. It > works fine on x86. But it leads to dead lock on mips where both > producer and consumer are suspended. Is this testcase correct? Only if you assume fair scheduling which is not necessarily the case. Assume the put() function has to stop because the buffer is full. The get() function now reads. It can read everything. Calling pthread_cond_signal() does not mean that the put() function gets running. Instead get() keeps running and exhausts the input buffer and then gets in the while (b->writepos == b->readpos) { pthread_cond_wait (&b->notempty, &b->lock); } loop where it can wake up immediately. put() never is required to be runnable. Therefore your revised code is not acceptable although it probably will almost always work. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------