Boost logo

Boost Users :

Subject: Re: [Boost-users] shared_ptr questions
From: Frank Mori Hess (frank.hess_at_[hidden])
Date: 2009-08-18 11:43:34


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tuesday 18 August 2009, John Dlugosz wrote:
> But I was specifically wondering about the mix of weak_ptr's. I guess mine
> is more complicated because it can do lazy copy on write, but still the
> effect of making the unowned pointer getting ownership at the same time as
> other threads are releasing all the existing owners was an issue of
> specific importance. I implemented a "sticky zero" non-blocking counter
> for the purpose.
>
> I want to make sure that the Boost implementation can do this robustly and
> efficiently, too. And perhaps point out that weak_ptr's need thread issue
> documentation too.

shared_ptr/weak_ptr does modify its reference count atomically. You can't
resurrect an expired shared_ptr through a weak_ptr, it will throw or return
an empty shared_ptr depending on whether you are using the shared_ptr
constructor or weak_ptr::lock.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkqKzCcACgkQ5vihyNWuA4W2HQCfV5IrvTt8NEuyY7+gFF9IJCui
yEsAoOP56qt3sTjgvHb3DlVTR8Dvj0WN
=DY5i
-----END PGP SIGNATURE-----


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