Subject: Re: [Boost-bugs] [Boost C++ Libraries] #4345: thread::id and joining problem with cascade of threads
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-06-16 03:25:47
#4345: thread::id and joining problem with cascade of threads
----------------------------------------------------------+-----------------
Reporter: bartek szurgot <bartosz.szurgot@â¦> | Owner: anthonyw
Type: Bugs | Status: new
Milestone: Boost 1.43.0 | Component: thread
Version: Boost 1.43.0 | Severity: Problem
Keywords: |
----------------------------------------------------------+-----------------
Comment(by steven_watanabe):
This code is very hard to follow, but here's what's happening in detail:
- An object of type B is created
- This creates a shared_ptr with a new A object
- The new A object starts thread A
- Thread B is created, and receives a copy of the B object, this copy is
not
destroyed until the last thread::id for this thread is gone.
- Thread B runs to completion and is joined. The last copy of B has not
yet
been destroyed, so there is no attempt to join thread A.
- Kaboom.
I don't think this should be considered a bug in the library. If you want
to join another thread when a thread exits, join at the end of the thread
function instead of in the destructor.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/4345#comment:2> 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:03 UTC