diff options
| author | redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-10-26 23:35:26 +0000 |
|---|---|---|
| committer | redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-10-26 23:35:26 +0000 |
| commit | 277a5aebe0ed91e9cbefb40966e235daba0f1728 (patch) | |
| tree | 4de7ba84aabea654f1cca3e126a6eb5536cacd38 /libstdc++-v3/include/std/condition_variable | |
| parent | 89dae0c084c32a94775b458b6c0dd682ba80e3ad (diff) | |
| download | ppe42-gcc-277a5aebe0ed91e9cbefb40966e235daba0f1728.tar.gz ppe42-gcc-277a5aebe0ed91e9cbefb40966e235daba0f1728.zip | |
PR libstdc++/50862
* include/std/condition_variable (condition_variable_any::wait): Avoid
terminating if relocking user mutex throws during stack-unwinding.
* testsuite/30_threads/condition_variable_any/50862.cc: Add dg-require.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@180549 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/std/condition_variable')
| -rw-r--r-- | libstdc++-v3/include/std/condition_variable | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libstdc++-v3/include/std/condition_variable b/libstdc++-v3/include/std/condition_variable index efc4a64ef1d..c4e2080165d 100644 --- a/libstdc++-v3/include/std/condition_variable +++ b/libstdc++-v3/include/std/condition_variable @@ -205,7 +205,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // scoped unlock - unlocks in ctor, re-locks in dtor struct _Unlock { explicit _Unlock(_Lock& __lk) : _M_lock(__lk) { __lk.unlock(); } - ~_Unlock() { _M_lock.lock(); } + ~_Unlock() noexcept(false) + { + if (uncaught_exception()) + __try { _M_lock.lock(); } __catch(...) { } + else + _M_lock.lock(); + } _Lock& _M_lock; }; |

