
25 Jul
2005
25 Jul
'05
10:36 p.m.
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 2002. 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, Christian