Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is an old version of boost. Click here for the latest version's documentation home page.
PrevUpHomeNext

Implementation Notes

Win32

Win32

In the current Win32 implementation, creating a boost::thread object during dll initialization will result in deadlock because the thread class constructor causes the current thread to wait on the thread that is being created until it signals that it has finished its initialization, and, as stated in the MSDN Library, "DllMain" article, "Remarks" section, "Because DLL notifications are serialized, entry-point functions should not attempt to communicate with other threads or processes. Deadlocks may occur as a result." (Also see "Under the Hood", January 1996 for a more detailed discussion of this issue).

The following non-exhaustive list details some of the situations that should be avoided until this issue can be addressed:

  • Creating a boost::thread object in DllMain() or in any function called by it.
  • Creating a boost::thread object in the constructor of a global static object or in any function called by one.
  • Creating a boost::thread object in MFC's CWinApp::InitInstance() function or in any function called by it.
  • Creating a boost::thread object in the function pointed to by MFC's _pRawDllMain function pointer or in any function called by it.

Last revised: October 15, 2006 at 14:52:53 GMT

Copyright 2001-2003 William E. Kempf

PrevUpHomeNext