Boost logo

Boost Users :

Subject: Re: [Boost-users] Is weak_ptr lock method thread safe?
From: Klaim - Joël Lamotte (mjklaim_at_[hidden])
Date: 2013-04-24 12:02:44


On Wed, Apr 24, 2013 at 8:56 AM, Slava <Viatcheslav.Sysoltsev_at_[hidden]>wrote:

> Sure? Looking at boost 1.53 headers I see it is not thread safe:

I believe the source isn't easy to follow on this, there are multiple
macros depending on
what platform and config macro you use.
Also, I believe the atomic "lockfree" counting happen in the shared_count
type, not directly into the shared_ptr class.

Nevertheless, all documentation I found through years suggest that it is
mandatory that shared_ptr counting is thread-safe
because it makes sharing between threads dangerous otherwise.

Unfortunately I don't have the standard available to check if
std::shared_ptr is HAVE TO be implemented this way.

Joel Lamotte



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