Opened 10 years ago
Last modified 10 years ago
#7540 closed Feature Requests
Add a helper class that join a thread on destruction — at Version 3
Reported by: | viboes | Owned by: | viboes |
---|---|---|---|
Milestone: | Boost 1.53.0 | Component: | thread |
Version: | Boost 1.52.0 | Severity: | Cosmetic |
Keywords: | Cc: |
Description (last modified by )
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 (3)
comment:1 by , 10 years ago
Status: | new → assigned |
---|
comment:2 by , 10 years ago
Description: | modified (diff) |
---|
comment:3 by , 10 years ago
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 |
Note:
See TracTickets
for help on using tickets.