Boost logo

Boost Users :

Subject: Re: [Boost-users] shared_ptr and weak_ptr concurrency
From: OvermindDL1 (overminddl1_at_[hidden])
Date: 2009-09-05 20:25:10


On Fri, Sep 4, 2009 at 1:36 PM, John Dlugosz<JDlugosz_at_[hidden]> wrote:
>> can you point to anything that the boost shared_ptr does that is unsafe
>> in the one-writer-multiple-reader case?
>
> Just looking at the header, I see two direct members, px and pn.
> So straight assignment isn't going to copy the struct in one atomic operation.

Actually you could. Atomic CAS instructions support up to 64bits on a
32bit platform, and 128bits on a 64bit platform. As long as those are
aligned and side-by-side, you can change both atomically. Although
Boost does not currently do this.


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