Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2008-08-20 16:12:41


Alan M. Carroll:

> Known issues:
> * May not handle cross assignment of target object.
> * No thread safety (not something I need, but should be thought about
> during Boostification)

Thread safety is a problem. Specifically, the race where thread A drops its
intrusive_ptr and thread B converts its weak pointer to an intrusive_ptr.
Thread B must end up with either NULL or an intrusive_ptr to a still valid
object. I'm not seeing an easy way to achieve this using your current
technique of using a member or a subobject whose destructor invalidates the
weak pointers since once the destructor is entered, it is too late to
prevent thread B from running away with its pointer to a zombie. :-)

http://www.boost.org/doc/libs/1_36_0/libs/smart_ptr/sp_techniques.html#weak_without_shared

is similar and does have the same problem, only worse. :-)


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