1 | <?xml version="1.0" encoding="utf-8"?> |
---|
2 | <!DOCTYPE library PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN" |
---|
3 | "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd" [ |
---|
4 | <!ENTITY % threads.entities SYSTEM "entities.xml"> |
---|
5 | %threads.entities; |
---|
6 | ]> |
---|
7 | <section id="threads.implementation_notes" last-revision="$Date: 2004/07/17 04:33:59 $"> |
---|
8 | <title>Implementation Notes</title> |
---|
9 | <section id="threads.implementation_notes.win32"> |
---|
10 | <title>Win32</title> |
---|
11 | <para> |
---|
12 | In the current Win32 implementation, creating a boost::thread object |
---|
13 | during dll initialization will result in deadlock because the thread |
---|
14 | class constructor causes the current thread to wait on the thread that |
---|
15 | is being created until it signals that it has finished its initialization, |
---|
16 | and, as stated in the |
---|
17 | <ulink url="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/dllmain.asp">MSDN Library, "DllMain" article, "Remarks" section</ulink>, |
---|
18 | "Because DLL notifications are serialized, entry-point functions should not |
---|
19 | attempt to communicate with other threads or processes. Deadlocks may occur as a result." |
---|
20 | (Also see <ulink url="http://www.microsoft.com/msj/archive/S220.aspx">"Under the Hood", January 1996</ulink> |
---|
21 | for a more detailed discussion of this issue). |
---|
22 | </para> |
---|
23 | <para> |
---|
24 | The following non-exhaustive list details some of the situations that |
---|
25 | should be avoided until this issue can be addressed: |
---|
26 | <itemizedlist> |
---|
27 | <listitem>Creating a boost::thread object in DllMain() or in any function called by it.</listitem> |
---|
28 | <listitem>Creating a boost::thread object in the constructor of a global static object or in any function called by one.</listitem> |
---|
29 | <listitem>Creating a boost::thread object in MFC's CWinApp::InitInstance() function or in any function called by it.</listitem> |
---|
30 | <listitem>Creating a boost::thread object in the function pointed to by MFC's _pRawDllMain function pointer or in any function called by it.</listitem> |
---|
31 | </itemizedlist> |
---|
32 | </para> |
---|
33 | </section> |
---|
34 | </section> |
---|