diff options
author | Eric Fiselier <eric@efcs.ca> | 2016-06-02 04:03:31 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2016-06-02 04:03:31 +0000 |
commit | 4efa1ad561d7f3e9b6e81f91b1ad684db55db157 (patch) | |
tree | 4a71d721fffa7ca6ae6656a47c84fc10a5189acd /libcxx/test/std/thread/thread.threads | |
parent | 3e7bf586f8a73dccf913d0f145bc576afb3ae52c (diff) | |
download | bcm5719-llvm-4efa1ad561d7f3e9b6e81f91b1ad684db55db157.tar.gz bcm5719-llvm-4efa1ad561d7f3e9b6e81f91b1ad684db55db157.zip |
Mark LWG issue 2250 as complete
llvm-svn: 271475
Diffstat (limited to 'libcxx/test/std/thread/thread.threads')
2 files changed, 40 insertions, 0 deletions
diff --git a/libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.member/detach.pass.cpp b/libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.member/detach.pass.cpp index 726395d9904..52c264be26b 100644 --- a/libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.member/detach.pass.cpp +++ b/libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.member/detach.pass.cpp @@ -17,8 +17,11 @@ #include <thread> #include <atomic> +#include <system_error> #include <cassert> +#include "test_macros.h" + std::atomic_bool done(false); class G @@ -57,6 +60,8 @@ public: int G::n_alive = 0; bool G::op_run = false; +void foo() {} + int main() { { @@ -70,4 +75,16 @@ int main() assert(G::n_alive == 1); } assert(G::n_alive == 0); +#ifndef TEST_HAS_NO_EXCEPTION + { + std::thread t0(foo); + assert(t0.joinable()); + t0.detach(); + assert(!t0.joinable()); + try { + t0.detach(); + } catch (std::system_error const& ec) { + } + } +#endif } diff --git a/libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.member/join.pass.cpp b/libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.member/join.pass.cpp index 0512e49dcb3..f0c3ef74c9a 100644 --- a/libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.member/join.pass.cpp +++ b/libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.member/join.pass.cpp @@ -19,6 +19,9 @@ #include <new> #include <cstdlib> #include <cassert> +#include <system_error> + +#include "test_macros.h" class G { @@ -42,6 +45,8 @@ public: int G::n_alive = 0; bool G::op_run = false; +void foo() {} + int main() { { @@ -50,5 +55,23 @@ int main() assert(t0.joinable()); t0.join(); assert(!t0.joinable()); +#ifndef TEST_HAS_NO_EXCEPTIONS + try { + t0.join(); + assert(false); + } catch (std::system_error const&) { + } +#endif + } +#ifndef TEST_HAS_NO_EXCEPTIONS + { + std::thread t0(foo); + t0.detach(); + try { + t0.join(); + assert(false); + } catch (std::system_error const&) { + } } +#endif } |