From: redi Date: Mon, 22 Sep 2014 14:54:35 +0000 (+0000) Subject: * include/std/mutex (try_lock): Do not swallow exceptions. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=25ca0d6166efd742c891752fa867a357385540e2;p=thirdparty%2Fgcc.git * include/std/mutex (try_lock): Do not swallow exceptions. * testsuite/30_threads/try_lock/4.cc: Fix test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@215467 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 9cbbe19419b2..aeb8afcc5823 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,8 @@ +2014-09-22 Jonathan Wakely + + * include/std/mutex (try_lock): Do not swallow exceptions. + * testsuite/30_threads/try_lock/4.cc: Fix test. + 2014-09-22 Jonathan Wakely PR libstdc++/54316 diff --git a/libstdc++-v3/include/std/mutex b/libstdc++-v3/include/std/mutex index f6b851c90b08..d80fa5a4ecd8 100644 --- a/libstdc++-v3/include/std/mutex +++ b/libstdc++-v3/include/std/mutex @@ -630,12 +630,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { int __idx; auto __locks = std::tie(__l1, __l2, __l3...); - __try - { __try_lock_impl<0>::__do_try_lock(__locks, __idx); } - __catch(const __cxxabiv1::__forced_unwind&) - { __throw_exception_again; } - __catch(...) - { } + __try_lock_impl<0>::__do_try_lock(__locks, __idx); return __idx; } diff --git a/libstdc++-v3/testsuite/30_threads/try_lock/4.cc b/libstdc++-v3/testsuite/30_threads/try_lock/4.cc index 774179826b24..1212b6596e9e 100644 --- a/libstdc++-v3/testsuite/30_threads/try_lock/4.cc +++ b/libstdc++-v3/testsuite/30_threads/try_lock/4.cc @@ -133,8 +133,15 @@ void test03() while (unreliable_lock::throw_on < 3) { unreliable_lock::count = 0; - int failed = std::try_lock(l1, l2, l3); - VERIFY( failed == unreliable_lock::throw_on ); + try + { + std::try_lock(l1, l2, l3); + VERIFY( false ); + } + catch (int e) + { + VERIFY( e == unreliable_lock::throw_on ); + } ++unreliable_lock::throw_on; } }