Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r52594 - sandbox/task/boost/task
From: oliver.kowalke_at_[hidden]
Date: 2009-04-25 17:16:33


Author: olli
Date: 2009-04-25 17:16:33 EDT (Sat, 25 Apr 2009)
New Revision: 52594
URL: http://svn.boost.org/trac/boost/changeset/52594

Log:
* async_handle() calls thread::join() after destruction (if created ny async_thread())

Text files modified:
   sandbox/task/boost/task/async.hpp | 13 ++++++++++++-
   1 files changed, 12 insertions(+), 1 deletions(-)

Modified: sandbox/task/boost/task/async.hpp
==============================================================================
--- sandbox/task/boost/task/async.hpp (original)
+++ sandbox/task/boost/task/async.hpp 2009-04-25 17:16:33 EDT (Sat, 25 Apr 2009)
@@ -52,6 +52,17 @@
         Attr const& attr)
 { return pool.submit( t, attr); }
 
+namespace detail
+{
+struct joiner
+{
+ void operator()( thread * thrd)
+ {
+ thrd->join();
+ delete thrd;
+ }
+};
+}
 
 template< typename R >
 async_handle< R > async_thread( task< R > t)
@@ -59,7 +70,7 @@
         detail::interrupter intr;
         detail::thread_callable ca( t, intr);
 
- shared_ptr< thread > thrd( new thread( ca) );
+ shared_ptr< thread > thrd( new thread( ca), detail::joiner() );
         ca.set( thrd);
 
         return async_handle< R >( t.get_id(), t.get_future(), intr);


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk