Boost logo

Threads-Devel :

Subject: Re: [Threads-devel] unbind passed function to the thread constructor after real thread exits
From: dadrus_at_[hidden]
Date: 2009-02-19 06:33:22

Thanks for a fast reply

> Are you sure this problem manifests with your simple example? Does it
> happen if you use boost::shared_ptr instead of boost::smart_ptr?

Sorry. My fault. I was using boost::shared_ptr

> Are you sure this is the behaviour you see?

Yes, defintely!

> The thread does indeed destroy the supplied function object when it is
> finished. As you say, if it did not there would be a lot of memory
> leaks.

In my real code needed a thread pooling, so i used Boost.Threadpool from boost vault. By testing i saw that my objects were not destroyed until threadpool itself is not deallocated. So i switched to boost::thread_group und used it like some kind of thread pool. But run into the same problem. So i wrote a simple test which looks quite similar to the example in my first post to this topic (using boost::shared_ptr). Got the same problem. As long as the corresponding thread object exists my object wrapped by shared_ptr is not destroyed.

I'm using the release 1.38 of boost.


Jetzt 1 Monat kostenlos! GMX FreeDSL - Telefonanschluss + DSL 
für nur 17,95 Euro/mtl.!*

Threads-Devel list run by bdawes at, david.abrahams at, gregod at, cpdaniel at, john at