1 | <html> |
---|
2 | <head> |
---|
3 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
---|
4 | <title>Implementation Notes</title> |
---|
5 | <link rel="stylesheet" href="../boostbook.css" type="text/css"> |
---|
6 | <meta name="generator" content="DocBook XSL Stylesheets V1.69.1"> |
---|
7 | <link rel="start" href="../index.html" title="The Boost C++ Libraries"> |
---|
8 | <link rel="up" href="../threads.html" title="Chapter 12. Boost.Threads"> |
---|
9 | <link rel="prev" href="../thread/build.html" title="Build"> |
---|
10 | <link rel="next" href="release_notes.html" title="Release Notes"> |
---|
11 | </head> |
---|
12 | <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> |
---|
13 | <table cellpadding="2" width="100%"> |
---|
14 | <td valign="top"><img alt="boost.png (6897 bytes)" width="277" height="86" src="../../../boost.png"></td> |
---|
15 | <td align="center"><a href="../../../index.htm">Home</a></td> |
---|
16 | <td align="center"><a href="../../../libs/libraries.htm">Libraries</a></td> |
---|
17 | <td align="center"><a href="../../../people/people.htm">People</a></td> |
---|
18 | <td align="center"><a href="../../../more/faq.htm">FAQ</a></td> |
---|
19 | <td align="center"><a href="../../../more/index.htm">More</a></td> |
---|
20 | </table> |
---|
21 | <hr> |
---|
22 | <div class="spirit-nav"> |
---|
23 | <a accesskey="p" href="../thread/build.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../threads.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="release_notes.html"><img src="../images/next.png" alt="Next"></a> |
---|
24 | </div> |
---|
25 | <div class="section" lang="en"> |
---|
26 | <div class="titlepage"><div><div><h3 class="title"> |
---|
27 | <a name="threads.implementation_notes"></a>Implementation Notes</h3></div></div></div> |
---|
28 | <div class="toc"><dl><dt><span class="section"><a href="implementation_notes.html#threads.implementation_notes.win32">Win32</a></span></dt></dl></div> |
---|
29 | <div class="section" lang="en"> |
---|
30 | <div class="titlepage"><div><div><h4 class="title"> |
---|
31 | <a name="threads.implementation_notes.win32"></a>Win32</h4></div></div></div> |
---|
32 | <p> |
---|
33 | In the current Win32 implementation, creating a boost::thread object |
---|
34 | during dll initialization will result in deadlock because the thread |
---|
35 | class constructor causes the current thread to wait on the thread that |
---|
36 | is being created until it signals that it has finished its initialization, |
---|
37 | and, as stated in the |
---|
38 | <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/dllmain.asp" target="_top">MSDN Library, "DllMain" article, "Remarks" section</a>, |
---|
39 | "Because DLL notifications are serialized, entry-point functions should not |
---|
40 | attempt to communicate with other threads or processes. Deadlocks may occur as a result." |
---|
41 | (Also see <a href="http://www.microsoft.com/msj/archive/S220.aspx" target="_top">"Under the Hood", January 1996</a> |
---|
42 | for a more detailed discussion of this issue). |
---|
43 | </p> |
---|
44 | <p> |
---|
45 | The following non-exhaustive list details some of the situations that |
---|
46 | should be avoided until this issue can be addressed: |
---|
47 | </p> |
---|
48 | <div class="itemizedlist"><ul type="disc"> |
---|
49 | <li>Creating a boost::thread object in DllMain() or in any function called by it.</li> |
---|
50 | <li>Creating a boost::thread object in the constructor of a global static object or in any function called by one.</li> |
---|
51 | <li>Creating a boost::thread object in MFC's CWinApp::InitInstance() function or in any function called by it.</li> |
---|
52 | <li>Creating a boost::thread object in the function pointed to by MFC's _pRawDllMain function pointer or in any function called by it.</li> |
---|
53 | </ul></div> |
---|
54 | </div> |
---|
55 | </div> |
---|
56 | <table width="100%"><tr> |
---|
57 | <td align="left"><small><p>Last revised: July 17, 2004 at 04:33:59 GMT</p></small></td> |
---|
58 | <td align="right"><small>Copyright © 2001-2003 William E. Kempf</small></td> |
---|
59 | </tr></table> |
---|
60 | <hr> |
---|
61 | <div class="spirit-nav"> |
---|
62 | <a accesskey="p" href="../thread/build.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../threads.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="release_notes.html"><img src="../images/next.png" alt="Next"></a> |
---|
63 | </div> |
---|
64 | </body> |
---|
65 | </html> |
---|