Add a helper class that join a thread on destruction
Based on the thread_guard class defined in C++ Concurrency in Action define a helper class that 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 (t.joinable())
{
t.join();
}
}
};
}
Change History
(7)
Description: |
modified (diff)
|
Description: |
modified (diff)
|
Summary: |
Add a helper class that interrupts a thread and join it on destruction → Add a helper class that join a thread on destruction
|
Milestone: |
To Be Determined
|
Milestone: |
→ Boost 1.53.0
|
Resolution: |
→ fixed
|
Status: |
assigned → closed
|
Committed revision [81074][81079].