Boost logo

Boost Users :

From: Christian Henning (chhenning_at_[hidden])
Date: 2005-07-25 17:36:20

Hi there, please help me out. Seems I lost my brain over the last weekend. ;-))

I'm trying to get myself familiar with the boost::thread lib, by
reading an article by Bill Kempf published in the C++ magazine in

Here in listing no. 4 he is using two thread (a reader and a writer )
to access a buffer. In the put() and get() he is using one mutex.

If the buffer is empty he uses a condition variable to block the
mutex. I don't understand how a writer can then enter the put() and
write an item into the buffer? The mutex was just blocked by the
reader thread?

I guess my question is more fundamental to threads. But hopefully
there is someone that can help me out.

Thanks ahead,

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at