boost.png (6897 bytes) Home Libraries People FAQ More

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: July 17, 2004 at 04:33:59 GMT

Copyright © 2001-2003 William E. Kempf

PrevUpHomeNext