Boost logo

Boost :

Subject: [boost] thread_safe_ptr class interest request
From: Philippe Vaucher (philippe.vaucher_at_[hidden])
Date: 2010-07-28 09:44:52


Hello,

I've made a thread_safe_ptr class available at http://codepad.org/PxDEGaFm

The idea is to use it like so:

std::string data = "Hello world;";
thread_safe_ptr<std::string> data_ptr(&data);

void thread1()
{
    data_ptr->resize(3);
}

void thread2()
{
    *data_ptr = "yeah";
}

boost::thread t1(&thread1);
boost::thread t2(&thread1);
t1.join(); t2.join();

Do you see an obvious show-stopper for me not to continue developping this
class?
What's still to be done is worry about ownership of objects, my idea is to
eventually somewhat model it after boost::shared_ptr that way it's easier to
pass those around.

When I'll be satisfied with the result, my plan is to "boostify" it
(namespaces, license etc) and maybe propose it for inclusion in the smart
pointer library.

What are your thoughts?

Philippe


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