Boost logo

Boost :

From: Michael Glassford (glassfordm_at_[hidden])
Date: 2004-04-16 16:42:03


Sorry, I meant to reply to this earlier and forgot.

Patrick Dreyer wrote:
> Markus Schöpflin wrote:
>
>> 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.

<snipped additional explanatory details>

Unfortunately, though the message you replied to is almost exactly two
years old, the problem still exists and still isn't documented, as far
as I know. I'll try either to fix it or document it sometime soon.

> My knowledge tells me, that you should not do any "complex" things
> during the Dll initialization, including starting threads.

<snipped MSDN link and copied text>

This is true, but it's not always obvious what this prohibition
applies to; for instance, the constructors of global static objects
are
called during dll initialization.

Mike


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