Boost logo

Boost :

From: Markus Schöpflin (markus.schoepflin_at_[hidden])
Date: 2002-04-10 05:16:41


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."

Markus


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