aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2014-09-22 15:54:35 +0100
committerJonathan Wakely <redi@gcc.gnu.org>2014-09-22 15:54:35 +0100
commit726d31362afc855b41260f0ab7f9318112285587 (patch)
treed3edeb60abfd92d2115a04f0ab0ad08bc32100e1
parented26fe9e4aa22ad8beac1b338f4ede8af69e1af3 (diff)
downloadgcc-726d31362afc855b41260f0ab7f9318112285587.zip
gcc-726d31362afc855b41260f0ab7f9318112285587.tar.gz
gcc-726d31362afc855b41260f0ab7f9318112285587.tar.bz2
mutex (try_lock): Do not swallow exceptions.
* include/std/mutex (try_lock): Do not swallow exceptions. * testsuite/30_threads/try_lock/4.cc: Fix test. From-SVN: r215467
-rw-r--r--libstdc++-v3/ChangeLog5
-rw-r--r--libstdc++-v3/include/std/mutex7
-rw-r--r--libstdc++-v3/testsuite/30_threads/try_lock/4.cc11
3 files changed, 15 insertions, 8 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 9cbbe19..aeb8afc 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,5 +1,10 @@
2014-09-22 Jonathan Wakely <jwakely@redhat.com>
+ * include/std/mutex (try_lock): Do not swallow exceptions.
+ * testsuite/30_threads/try_lock/4.cc: Fix test.
+
+2014-09-22 Jonathan Wakely <jwakely@redhat.com>
+
PR libstdc++/54316
PR libstdc++/53626
* config/abi/pre/gnu.ver: Add new exports.
diff --git a/libstdc++-v3/include/std/mutex b/libstdc++-v3/include/std/mutex
index f6b851c..d80fa5a 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 7741798..1212b65 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;
}
}