From: Roland (roland.schwarz_at_[hidden])
Date: 2004-07-28 01:24:07
On Tue, 27 Jul 2004 22:23:21 -0400 Michael Glassford <glassfordm_at_[hidden]> wrote:
> The next release will clean up TLS right after the thread function
> exits, but that doesn't work for threads that aren't created by
> Boost.Threads. If that's good enough for you, good! However, if you need
> TLS cleanup for threads not created by Boost.Threads, the
> DLL_THREAD_DETACH or some other approach is still necessary.
As I pointed out in another posting:
DLL_THREAD_DETACH might already be too late for cleanup.
You are relying on the fact that the c-runtime (with respect to this very thread)
is still in a sane state! In fact it might not since the runtimes own detach functions
already have been called at this time. (Happens within _endthread).
So I think doing the cleanup after a boost thread has ended is very reasonable.
Nevertheless I am currently trying to accomplish the very same functionality
by transparently "hooking" _endthread to call the cleanup code. This way
some of the orthogonality is given back, since it is most likely that other
threads are based on _beginthread _endthread at minimum (These are
required to work with the C-Run time).
Going this way would only preclude using native threads, which I consider
beeing a minor nuisance.