Boost logo

Boost :

From: Jonathan H Lundquist (jhl_at_[hidden])
Date: 2001-10-12 11:15:30


I'm having a problem that I wouldn't normally look to this group to assist
with (as it's in non-boost code), however I can't find an answer on
comp.programming.threads; so, I took a look at boost threads in hopes it had
been solved there, and as far as I can tell it would suffer from the same
problem.

I have a worker thread running in a dll, for which I have no control over
the process lifetime. When the process exits the dll is going to run its
static destructors. The thread accesses static data (properly
synchronized), so I need to arrange for it to terminate before static
destructors are run. If I give it some kind of signal to terminate, and
then attempt to wait for it to do so in dllmain DLL_PROCESS_DETACH, then I
deadlock due to the serialization of dllmain.

It looks to me like boost threads would have exactly the same problem if the
main thread attempted to join worker threads at DLL_PROCESS_DETACH time.
Any ideas on how one can correctly ensure all but the main thread have
terminated before static destructors are run in a dll would be appreciated.
Thank you.


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