Boost logo

Boost :

From: Mark Rodgers (mark.rodgers_at_[hidden])
Date: 2002-05-16 14:32:26


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?

Thanks
Mark


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