Subject: Re: [Boost-bugs] [Boost C++ Libraries] #7540: Add a helper class that interrupts a thread and join it on destruction
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-10-23 16:09:17
#7540: Add a helper class that interrupts a thread and join it on destruction
-------------------------------+--------------------------------------------
Reporter: viboes | Owner: viboes
Type: Feature Requests | Status: assigned
Milestone: To Be Determined | Component: thread
Version: Boost 1.52.0 | Severity: Cosmetic
Resolution: | Keywords:
-------------------------------+--------------------------------------------
Description changed by viboes:
Old description:
> Based on the thread_guard class defined in C++ Concurrency in Action
> define a helper class that interrupts and join a thread on destruction.
New description:
Based on the thread_guard class defined in C++ Concurrency in Action
define a helper class that interrupts and join a thread on destruction.
{{{
// Based on the Anthony's idea of thread_guard in CCiA
namespace boost
{
class thread_guard
{
thread& t;
public:
BOOST_THREAD_NO_COPYABLE( thread_guard )
explicit thread_guard(thread& t_) :
t(t_)
{
}
~thread_guard()
{
#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
t.interrupt();
#endif
if (t.joinable())
{
t.join();
}
}
};
}
}}}
-- -- Ticket URL: <https://svn.boost.org/trac/boost/ticket/7540#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:11 UTC