|
Boost Users : |
Subject: Re: [Boost-users] Several novice questions concerning threading
From: Rob Desbois (rob.desbois_at_[hidden])
Date: 2012-04-12 18:16:21
On 12 April 2012 17:32, Master <master.huricane_at_[hidden]> 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<http://en.highscore.de/cpp/boost/>(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
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net