aboutsummaryrefslogtreecommitdiff
path: root/paludis/util/process.cc
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2013-05-16 16:26:36 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2013-05-22 16:43:42 +0100
commit9c7d9f9aef92e9073ee9d295b1ed5ea779f8a96d (patch)
tree819d9ef6fabaa7a4c91b0beeaf1ac8a895cdaf29 /paludis/util/process.cc
parenta61bc76abeb201333fc28276d3d87d3a128c6f0e (diff)
downloadpaludis-9c7d9f9aef92e9073ee9d295b1ed5ea779f8a96d.tar.gz
paludis-9c7d9f9aef92e9073ee9d295b1ed5ea779f8a96d.tar.xz
Use std::thread
Diffstat (limited to 'paludis/util/process.cc')
-rw-r--r--paludis/util/process.cc14
1 files changed, 10 insertions, 4 deletions
diff --git a/paludis/util/process.cc b/paludis/util/process.cc
index 48bb928..22f8cb5 100644
--- a/paludis/util/process.cc
+++ b/paludis/util/process.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2010, 2011 Ciaran McCreesh
+ * Copyright (c) 2010, 2011, 2012 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -19,7 +19,6 @@
#include <paludis/util/process.hh>
#include <paludis/util/pimp-impl.hh>
-#include <paludis/util/thread.hh>
#include <paludis/util/pipe.hh>
#include <paludis/util/pty.hh>
#include <paludis/util/fs_path.hh>
@@ -36,6 +35,7 @@
#include <map>
#include <cstdlib>
#include <cstring>
+#include <thread>
#include <errno.h>
#include <unistd.h>
@@ -194,7 +194,7 @@ namespace paludis
bool as_main_process;
/* must be last, so the thread gets join()ed before its FDs vanish */
- std::unique_ptr<Thread> thread;
+ std::thread thread;
RunningProcessThread() :
ctl_pipe(true),
@@ -206,6 +206,12 @@ namespace paludis
{
}
+ ~RunningProcessThread()
+ {
+ if (thread.joinable())
+ thread.join();
+ }
+
void thread_func();
void start();
@@ -481,7 +487,7 @@ RunningProcessThread::thread_func()
void
RunningProcessThread::start()
{
- thread.reset(new Thread(std::bind(&RunningProcessThread::thread_func, this)));
+ thread = std::thread(std::bind(&RunningProcessThread::thread_func, this));
}
namespace paludis