Boost logo

Threads-Devel :

Subject: Re: [Threads-devel] Cleanup within dll
From: Anthony Williams (anthony_at_[hidden])
Date: 2008-09-04 09:38:26


At Thu 04 Sep 2008 13:50:20 BST, Rudi Lindl <rudi.lindl_at_[hidden]> wrote:

> I have trouble with a clean up function within a dll.

[snip code]

> But the cleanup funtion is not called. Any Idea?
> If i move the myDllFuntion, void detach_thread funtion and the declaration
> of the boost::thread_specific_ptr<unsigned int>
> current_thread_index(&detach_thread) from the dll to the file where the main
> funtions is defined everything works as expected.

I'm going to make a stab in the dark and guess that you're linking
statically against Boost.Thread from both the main app and the DLL? If
so, then this is the reason: the DLL cannot hook the TLS cleanup into
the boost::thread data structure from the main app, so the cleanup
isn't called.

If you *are* using the DLL version of Boost.Thread, then I'll have to
investigate further.

Anthony

-- 
Anthony Williams            | Just Software Solutions Ltd
Custom Software Development | http://www.justsoftwaresolutions.co.uk
Registered in England, Company Number 5478976.
Registered Office: 15 Carrallack Mews, St Just, Cornwall, TR19 7UL

Threads-Devel list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk