[Boost-bugs] [Boost C++ Libraries] #5843: thread.cpp: thread::join() does not throw for a non-joinable thread

Subject: [Boost-bugs] [Boost C++ Libraries] #5843: thread.cpp: thread::join() does not throw for a non-joinable thread
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-08-30 07:31:44


#5843: thread.cpp: thread::join() does not throw for a non-joinable thread
--------------------------------+-------------------------------------------
 Reporter: noloader@… | Owner:
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: None
  Version: Boost 1.47.0 | Severity: Problem
 Keywords: |
--------------------------------+-------------------------------------------
 Boost uses non-joinable threads. For example, under Windows:

 {{{
 thread::thread() : m_joinable(false)
 {
     m_thread = reinterpret_cast<void*>(GetCurrentThread());
     m_id = GetCurrentThreadId();
 }
 }}}

 The thread::join() properly asserts the property, but still attempts to
 join a non-joinable thread:

 {{{
 void thread::join()
 {
     assert(m_joinable); //See race condition comment below
     int res = 0;

     res = WaitForSingleObject(reinterpret_cast<HANDLE>(m_thread),
 INFINITE);
     assert(res == WAIT_OBJECT_0);
     res = CloseHandle(reinterpret_cast<HANDLE>(m_thread));
     assert(res);
     // This isn't a race condition since any race that could occur would
     // have us in undefined behavior territory any way.
     m_joinable = false;
 }
 }}}

 Related to https://svn.boost.org/trac/boost/ticket/5838 and
 https://svn.boost.org/trac/boost/ticket/5842.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/5843>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:07 UTC