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 % thread.entities SYSTEM "entities.xml"> |
---|
5 | %thread.entities; |
---|
6 | ]> |
---|
7 | <!-- Copyright (c) 2002-2003 William E. Kempf, Michael Glassford |
---|
8 | Subject to the Boost Software License, Version 1.0. |
---|
9 | (See accompanying file LICENSE-1.0 or http://www.boost.org/LICENSE-1.0) |
---|
10 | --> |
---|
11 | <section id="thread.implementation_notes" last-revision="$Date: 2006/10/15 14:52:53 $"> |
---|
12 | <title>Implementation Notes</title> |
---|
13 | <section id="thread.implementation_notes.win32"> |
---|
14 | <title>Win32</title> |
---|
15 | <para> |
---|
16 | In the current Win32 implementation, creating a boost::thread object |
---|
17 | during dll initialization will result in deadlock because the thread |
---|
18 | class constructor causes the current thread to wait on the thread that |
---|
19 | is being created until it signals that it has finished its initialization, |
---|
20 | and, as stated in the |
---|
21 | <ulink url="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/dllmain.asp">MSDN Library, "DllMain" article, "Remarks" section</ulink>, |
---|
22 | "Because DLL notifications are serialized, entry-point functions should not |
---|
23 | attempt to communicate with other threads or processes. Deadlocks may occur as a result." |
---|
24 | (Also see <ulink url="http://www.microsoft.com/msj/archive/S220.aspx">"Under the Hood", January 1996</ulink> |
---|
25 | for a more detailed discussion of this issue). |
---|
26 | </para> |
---|
27 | <para> |
---|
28 | The following non-exhaustive list details some of the situations that |
---|
29 | should be avoided until this issue can be addressed: |
---|
30 | <itemizedlist> |
---|
31 | <listitem>Creating a boost::thread object in DllMain() or in any function called by it.</listitem> |
---|
32 | <listitem>Creating a boost::thread object in the constructor of a global static object or in any function called by one.</listitem> |
---|
33 | <listitem>Creating a boost::thread object in MFC's CWinApp::InitInstance() function or in any function called by it.</listitem> |
---|
34 | <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> |
---|
35 | </itemizedlist> |
---|
36 | </para> |
---|
37 | </section> |
---|
38 | </section> |
---|