id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 7541,Add a thread wrapper class that joins on destruction,viboes,viboes,"Based on the scoped_thread class defined in C++ Concurrency in Action define a thread wrapper class that instead of calling terminate if the thread is joinable on destruction, join it if joinable. While the scoped_thread class defined in C++ Concurrency in Action is a strict scoped class that doesn't allows any change in the wrapped thread, I think that making the interface thread compatible is also a good option. This doesn't means that a strict scoped thread has no use. {{{ namespace boost { class scoped_thread : public thread { typedef thread base_type; public: BOOST_THREAD_MOVABLE_ONLY( scoped_thread ) explicit scoped_thread(BOOST_THREAD_RV_REF(thread) t_) : base_type(boost::forward(t_)), m_(*static_cast(this)) { } scoped_thread(BOOST_RV_REF(scoped_thread) x) : base_type(boost::move(static_cast(x))) { } scoped_thread& operator=(BOOST_RV_REF(scoped_thread) x) { base_type::operator=(boost::move(static_cast(x))); return *this; } ~scoped_thread() { if (joinable()) { join(); } } }; inline void swap(scoped_thread& lhs,scoped_thread& rhs) BOOST_NOEXCEPT { return lhs.swap(rhs); } } }}} ",Feature Requests,closed,Boost 1.53.0,thread,Boost 1.52.0,Cosmetic,fixed,,