Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2005-08-18 13:12:29


"Robert Ramey" <ramey_at_[hidden]> writes:

> Vladimir Prus wrote:
>> I think you're going contrary to the basic threading assumption in
>> the C++. If I explicitly use the same object from two different
>> threads, I must use locking myself.
>
> This is what I disagree with. I don't any problem with multiple threads
> accessing the same data structures as long as the accesses are read-only and
> the structures are not being modified.

Yes, that's the part that Vladimir left out. Of course if there's no
modification then no locking is needed.

>> If, for all appearence, I don't
>> use the same object in two threads, but there's some *internal*
>> shared data structure, it should be protected *internally*. In this
>> case, there's some internal serialization table that I know nothing
>> about, so it should be protected by serialization library.
>
> Repeat, I don't think this is necessary.

Why not? Is there no mutation at all?

> OK - lets hear it from someone who is going to say the really need to be
> able to create multiple different simultaneaous serializations.

All I can say is that serialization and concurrency are natural
partners, since serializing/deserializing is commonly used for
interprocess communication. Whether it will apply to threads, I can't
say.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk