Re: [Boost-bugs] [Boost C++ Libraries] #5754: Bug/design issue with boost::thread::id

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #5754: Bug/design issue with boost::thread::id
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-03-08 16:16:02


#5754: Bug/design issue with boost::thread::id
---------------------------------------+------------------------------------
  Reporter: ZenJu <zhnmju123@…> | Owner: viboes
      Type: Bugs | Status: closed
 Milestone: To Be Determined | Component: thread
   Version: Boost 1.47.0 | Severity: Showstopper
Resolution: duplicate | Keywords: thread::id
---------------------------------------+------------------------------------

Comment (by anonymous):

 Replying to [comment:3 viboes]:
> duplicate of #4345 thread::id and joining problem with cascade of
 threads

 I have encountered another manifestation of this issue. I have produced a
 very simple test program that will exhibit the issue:



 {{{
 #include <boost/thread.hpp>
 #include <boost/shared_ptr.hpp>
 void GetThreadId(boost::shared_ptr<boost::thread::id> tidPtr)
 {
     *tidPtr = boost::this_thread::get_id();
 }
 int main(int argc, char* argv[])
 {
     for(;;)
     {
         boost::shared_ptr<boost::thread::id> tidPtr(new
 boost::thread::id());
         boost::thread thread(GetThreadId, tidPtr);
         tidPtr.reset(); // force necessity to pass tidPtr by value
         thread.join();
     }
     return 0;
 }

 }}}
 This program leaks memory every time around the for loop in main.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/5754#comment:4>
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:09 UTC