This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
[C++0x] n2880 do not detach std::thread by default
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: "libstdc++" <libstdc++ at gcc dot gnu dot org>
- Date: Mon, 15 Jun 2009 19:44:59 +0100
- Subject: [C++0x] n2880 do not detach std::thread by default
n2880 changed the behaviour of std::thread so that it calls
std::terminate() if the thread is joinable when destroyed or assigned
to.
I want to commit this to trunk and 4.4, but what's the best way to
test it? (all current tests pass, because they always explicitly
join() or detach() thread objects.)
Index: include/std/thread
===================================================================
--- include/std/thread (revision 148467)
+++ include/std/thread (working copy)
@@ -135,7 +135,7 @@ namespace std
~thread()
{
if (joinable())
- detach();
+ std::terminate();
}
thread& operator=(const thread&) = delete;
@@ -143,7 +143,7 @@ namespace std
thread& operator=(thread&& __t)
{
if (joinable())
- detach();
+ std::terminate();
swap(__t);
return *this;
}