summaryrefslogtreecommitdiff
path: root/boost/thread/thread_functors.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/thread/thread_functors.hpp')
-rw-r--r--boost/thread/thread_functors.hpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/boost/thread/thread_functors.hpp b/boost/thread/thread_functors.hpp
index bba129f767..f134593ffe 100644
--- a/boost/thread/thread_functors.hpp
+++ b/boost/thread/thread_functors.hpp
@@ -21,15 +21,29 @@ namespace boost
struct detach
{
- void operator()(thread& t)
+ template <class Thread>
+ void operator()(Thread& t)
{
t.detach();
}
};
+ struct detach_if_joinable
+ {
+ template <class Thread>
+ void operator()(Thread& t)
+ {
+ if (t.joinable())
+ {
+ t.detach();
+ }
+ }
+ };
+
struct join_if_joinable
{
- void operator()(thread& t)
+ template <class Thread>
+ void operator()(Thread& t)
{
if (t.joinable())
{
@@ -41,7 +55,8 @@ namespace boost
#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
struct interrupt_and_join_if_joinable
{
- void operator()(thread& t)
+ template <class Thread>
+ void operator()(Thread& t)
{
if (t.joinable())
{