Boost logo

Boost :

From: William Kempf (williamkempf_at_[hidden])
Date: 2002-04-10 09:17:31


>Boosters,
>
>there are some pitfalls using boost::thread on the win32 plattform
>if DLLs are involved. As I could find nothing in the documentation
>mentioning this I would like to ask if a strong warning could be
>added, that creating threads in DllMain() or in a global object
>living in a DLL will deadlock. This is especially suprising as
>using _beginthread() or CreateThread() does work in such places.
>
>The problem is, when boost::thread creates a thread it explicitly
>waits for the start up of the newly created thread. But if the
>creator of the thread itself is in DllMain() or something alike
>the newly created thread won't start until the creator leaves
>DllMain().
>
>The documentation for CreateThread() in the plattform SDK says
>the following on this subjekt: "During process startup and DLL
>initialization routines, new threads can be created, but they
>do not begin execution until DLL initialization is done for the
>process."

Thanks for bringing this to my attention. I was aware of the issues
involved here, but didn't make the mental connection that the implementation
would cause any issues. Since I never create a thread in DllMain() or in a
globaly constructed object the problem never presented itself to me. I'll
look into whether there's a way to eliminate this undesirable behavior, or
if not, add documentation to this effect.

Bill Kempf
williamkempf_at_[hidden]

_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail.
http://www.hotmail.com


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