Boost logo

Boost :

From: Sam Partington (sam.partington_at_[hidden])
Date: 2006-01-30 11:02:06


> You can avoid having to make the implementation thread safe by making the
> pointee thread safe.
> This can be done by using an intrusive lock.

How? The FAQ is talking about making the reference count thread safe,
not the object thread safe.

class A { };

void f(ptr<A> a) { }

int main()
{
        ptr<A> a(new A);
        boost::thread t(boost::bind(f, a));
}

Which thread does the deallocation of a? What protects both of them
from trying to deallocate it at the same time?

> I guess this could be considered not enough of an advantage if 22% to 30%
> extra efficiency is not that important.
> But some developers would differ.

Until there is a thread safe implemenation then any performance
comparisons are irrelevant because you're comparing apples and
oranges.

Sam


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk