Boost logo

Boost :

From: Schalk_Cronje_at_[hidden]
Date: 2003-04-08 10:36:27


I was given this code snippet by a colleague (compiled with MSVC6). The problem is that the second reset() delete the MyClass instance. However when on_thread_exit() is called, a second attempt to delete the instance is made. I was given a diff for the fix, but I would like to know if someone has come across this as well.

-- Forwarded message

> Schalk,
>
> The following code demonstrates a bug in the thread module of Boost under MSVC when using thread specific storage:
>
> #include <boost/thread/tss.hpp>
> #include <iostream>
>
> class MyClass
> {
> public:
> MyClass() { std::cout << "Up " << this << std::endl; }
> ~MyClass() { std::cout << "Down " << this << std::endl; }
> };
>
> boost::thread_specific_ptr<MyClass> MyPtr;
>
> int main()
> {
> MyPtr.reset(new MyClass);
> MyPtr.reset();
> return 0;
> }
>



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