From: Chris Elliott (cpelliott_at_[hidden])
Date: 2002-04-05 11:13:30
I am new to boost smart pointers, but have been using a similar custom version of smart pointers for a while.
With true atomic operations, I am curious why the pthread mutex is necessary. I have tried to come up with a race condition for smart pointers (without a mutex) which would cause a failure, but have been unable to do so. One obvious candidate is impossible due to the use of smart pointers. That candidate is if the reference count could be decremented to zero just before you try to increment it. This is not possible because there is no way the other smart pointer can go out of scope during a copy constructor or operator=.
Can anyone help me out and give a case where smart pointers could fail without the use of a mutex?
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk