From: Michael Glassford (glassfordm_at_[hidden])
Date: 2004-08-03 09:13:20
Aaron W. LaFramboise wrote:
[snip previous conversation]
>>The DllMain() or tls_callback() functions call on_thread_enter() for
>>both the DLL_PROCESS_ATTACH and the DLL_THREAD_ATTACH messages, and they
>>call on_thread_exit for both the DLL_PROCESS_DETACH and
>>This scheme seems a little cleaner and so far seems to be working OK.
>>Any thoughts about this?
> Yes I think reference counting seems like a good idea here.
> The only concern I have--I don't know how important this is--is that
> when a thread is killed with TerminateThread, I think neither TLS
> callbacks nor DllMain()s will be called. This would cause the TLS count
> to never reach zero, and for TlsFree to never be called.
Good point. Two comments: 1) If you're calling TerminateThread, you're
probably already leaking; maybe one more leak won't matter. And...
> These threads might not even be associated with the Boost TSS at all.
> For example, another third party library in some DLL might be using
> TerminateThread, and the application programmer may not even know about
> this, so it may be suprising to him when the reference count never
> reaches zero for apparently no good reason.
2) I"m only reference counting threads on which Boost.Threads tss is
actually used, so this shouldn't happen.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk