Boost logo

Boost Users :

Subject: Re: [Boost-users] shared_ptr and weak_ptr concurrency
From: Kevin Kassil (k.kassil_at_[hidden])
Date: 2009-09-04 10:31:35


Stefan,

On Thu, Sep 3, 2009 at 2:30 AM, Stefan Strasser <strasser_at_[hidden]>wrote:
...

> why would you even need a lock here?
> the shared_ptr doc says that you can expect the same thread safety from
> shared_ptr as you can from built-in types.
> you can use multiple-readers-single-writer without any locks on built-in
> types.
>
>
You can? Is assigning to a char or a double guaranteed to be atomic? How
can the compiler guarantee that? -- What if there is some architecture for
which it's not a single instruction assignment?

Kevin



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