Boost C++ Libraries: Ticket #5842: thread.cpp: Win32 thread::thread() calls GetCurrentThread, which returns a pseudo-handle https://svn.boost.org/trac10/ticket/5842 <p> <a class="missing wiki">GetCurrentThread</a>() returns a pseudo-handle. All threads which call it are returned a value of (HANDLE)-2 (if I recall correctly). To get a 'real' handle, use <a class="missing wiki">DuplicateHandle</a>() <a class="changeset" href="https://svn.boost.org/trac10/changeset/1" title="Import core sources for SVNmanger 0.38 ">[1]</a>. </p> <pre class="wiki">thread::thread() : m_joinable(false) { m_thread = reinterpret_cast&lt;void*&gt;(GetCurrentThread()); m_id = GetCurrentThreadId(); } </pre><p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/1" title="Import core sources for SVNmanger 0.38 ">[1]</a> <a class="ext-link" href="http://msdn.microsoft.com/en-us/library/ms683182(v=vs.85).aspx"><span class="icon">​</span>http://msdn.microsoft.com/en-us/library/ms683182(v=vs.85).aspx</a> </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5842 Trac 1.4.3 Jeffrey Walton <noloader@…> Wed, 31 Aug 2011 00:46:13 GMT component changed; owner set https://svn.boost.org/trac10/ticket/5842#comment:1 https://svn.boost.org/trac10/ticket/5842#comment:1 <ul> <li><strong>owner</strong> set to <span class="trac-author">Anthony Williams</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">thread</span> </li> </ul> Ticket viboes Wed, 07 Dec 2011 00:36:45 GMT <link>https://svn.boost.org/trac10/ticket/5842#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5842#comment:2</guid> <description> <p> Are you sure that this pseudo handle is used by another thread? </p> <p> BTW, thanks for all your reports. This will help a lot to make Boost.Thread more robust :) </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Wed, 07 Dec 2011 21:24:37 GMT</pubDate> <title>owner, status, type changed https://svn.boost.org/trac10/ticket/5842#comment:3 https://svn.boost.org/trac10/ticket/5842#comment:3 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Anthony Williams</span> to <span class="trac-author">viboes</span> </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> <li><strong>type</strong> <span class="trac-field-old">Bugs</span> → <span class="trac-field-new">Support Requests</span> </li> </ul> <p> Moved to support request until resolution clarified. </p> Ticket viboes Tue, 20 Dec 2011 17:26:58 GMT status, type changed; resolution set https://svn.boost.org/trac10/ticket/5842#comment:4 https://svn.boost.org/trac10/ticket/5842#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>type</strong> <span class="trac-field-old">Support Requests</span> → <span class="trac-field-new">Bugs</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">invalid</span> </li> </ul> <p> It seems that this pseudo-handle is not used by other threads, so no need to duplicate. </p> <p> Please, reopen it if you don't agree with the resolution. </p> Ticket