Boost logo

Boost :

From: William E. Kempf (williamkempf_at_[hidden])
Date: 2002-05-16 15:25:45


----- Original Message -----
From: "Mark Rodgers" <mark.rodgers_at_[hidden]>

> We have a problem with Boost.Threads within a DLL. When
> exiting, our DLL (which uses TSS) is being unloaded before
> the threadmon DLL. That means that when threadmon comes to
> call the cleanup function in our DLL, that function called
> is no more, and an access violation occurs.
>
> We've got around it by hacking threadmon.cpp to export a
> function that does the cleanup:
>
> void BOOST_THREADMON_API boost_cleanup_tss()
> {
> exit_handlers* handlers
> = static_cast<exit_handlers*>(TlsGetValue(key));
> if (handlers)
> {
> for (exit_handlers::iterator it = handlers->begin();
> it != handlers->end(); ++it)
> (*it)();
> TlsSetValue(key,0);
> }
> }
>
> Then we call this within our own DLLMain on DLL_PROCESS_DETACH.
>
> Any chance of making something along these lines official, or
> providing someother solution?

I'm not sure what solution should be used. I'll have to look into this one.
Thanks for the report, though. I'll keep you posted on what I discover.

Bill Kempf


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