Re: [Boost-bugs] [Boost C++ Libraries] #2144: boost::thread constructor wants to make copies of the argument

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #2144: boost::thread constructor wants to make copies of the argument
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2008-07-25 08:06:54


#2144: boost::thread constructor wants to make copies of the argument
------------------------------------+---------------------------------------
  Reporter: mmikucionis_at_[hidden] | Owner: anthonyw
      Type: Bugs | Status: closed
 Milestone: Boost 1.36.0 | Component: thread
   Version: Boost 1.35.0 | Severity: Optimization
Resolution: wontfix | Keywords:
------------------------------------+---------------------------------------
Changes (by anthonyw):

  * status: new => closed
  * resolution: => wontfix

Comment:

 Yes, as you noted the copying ensures the object lives as long as the
 thread.

 If you need to use a large, non-copyable object you can either use a
 pointer (as in your example), or use boost::ref:

 foo large_object;
 boost::thread t(boost::ref(large_object));

 If you do this it is up to you to ensure that the referenced object
 outlives the thread.

-- 
Ticket URL: <http://svn.boost.org/trac/boost/ticket/2144#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:49:58 UTC