|
Boost : |
From: John Fuller (jfuller_at_[hidden])
Date: 2004-02-13 08:29:11
You're right about synchronized<> as far as containers are concerned.
Here's Ted Yuan's ProducerConsumer code from CUJ Jan '04
which does explicitly lock around these cases (ex: in offer and poll
calls
for a channel (a template wrapper for a container type)).
On Feb 13, 2004, at 2:23 AM, Vladimir Prus wrote:
> John Fuller wrote:
>
>> both Ted Yuan's producer-consumer templates (cujjan2004)
>> and the synchronized template
>> at http://libcalc.sourceforge.net/synchronized.hpp
>> are nice thread-safe container implementations...
>
> I could not find the first reference. Looking at the second, it seems
> to
> implement the same idea as Raoul Gough's presented. And of course,
> I'll ask
> the same question: if I have code like
>
> if (!proxy->empty()) {
> int value = proxy->front();
> //....
> }
>
> what prevents other thread from extracting all elements between the two
> calls?
>
> - Volodya
>
>
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk