On 12 April 2012 17:32, Master <master.huricane@gmail.com> wrote:
On first iteration:
* Writer gains the lock
* Reader is blocked while trying to obtain lock
* Writer calls condition.notify_all()
* Writer calls condition.wait(), thus releasing the mutex and blocking itself until condition.notify_*()
* Reader is unblocked
* Reader calls condition.wait(), releasing the mutex and blocking itself until condition.notify_*()

:-)
--rob
i just merely copied the example from this link (Multithread section exercises ) ! so this means the example is faulty ? 

I couldn't see anything similar to your posted code there - are you referring to section 6.5?

Unless my thinking's gone inside-out (which isn't unheard of..) then I believe the process I described is what is happening in your case.

--rob