|
Boost : |
From: Vladimir Prus (ghost_at_[hidden])
Date: 2001-08-13 08:39:19
On Sunday 12 August 2001 17:42, williamkempf_at_[hidden] wrote:
> Usage of CVs is trivial and doesn't require any "careful analysis to
> figure out how to use them properly in any particular situation".
I agree, but find that documentation for conditions fails to explain their
purpose clearly enough. Having known nothing about conditions and
read the first sentence,
"An object of class condition is a synchronization primitive used to
cause a thread to wait until a particular condition (or time) is met."
I thought, "and why this isn't called event?" The second sentence
made matters worse -- it says about mutex without no explanation why it's
needed.
After some thought, my understanding is that condition's role is to perform
wait-for-some-notification-and-lock-mutex operation, and to perform it
atomically, so that no other thread can grab mutex between "wait" and "lock"
parts. If I correctly understood, it would be better if docs for conditions
explain them in this way, else many potential users will think that
conditions require "carefull analysis". And reader/writer situation as
motivating example can also be mentioned right in th beginning.
-- Regards, Vladimir
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk