From b0767852f74a2270e24d497d36b75e1490b0299e Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Wed, 26 Mar 2014 02:45:04 +0000 Subject: [PATCH] Implement LWG issue #2135. If something goes wrong in condition_variable::wait, call terminate() rather than throwing an error. Do this indirectly, by marking the call as 'noexcept'. This is better than just calling terminate() directly, because it gives a better error message on the console. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@204778 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/__mutex_base | 4 ++-- src/condition_variable.cpp | 4 ++-- www/cxx1y_status.html | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/__mutex_base b/include/__mutex_base index abb1c125..293feada 100644 --- a/include/__mutex_base +++ b/include/__mutex_base @@ -282,7 +282,7 @@ public: void notify_one() _NOEXCEPT; void notify_all() _NOEXCEPT; - void wait(unique_lock& __lk); + void wait(unique_lock& __lk) _NOEXCEPT; template void wait(unique_lock& __lk, _Predicate __pred); @@ -313,7 +313,7 @@ public: private: void __do_timed_wait(unique_lock& __lk, - chrono::time_point); + chrono::time_point) _NOEXCEPT; }; template diff --git a/src/condition_variable.cpp b/src/condition_variable.cpp index de0f6f47..061d1388 100644 --- a/src/condition_variable.cpp +++ b/src/condition_variable.cpp @@ -32,7 +32,7 @@ condition_variable::notify_all() _NOEXCEPT } void -condition_variable::wait(unique_lock& lk) +condition_variable::wait(unique_lock& lk) _NOEXCEPT { if (!lk.owns_lock()) __throw_system_error(EPERM, @@ -44,7 +44,7 @@ condition_variable::wait(unique_lock& lk) void condition_variable::__do_timed_wait(unique_lock& lk, - chrono::time_point tp) + chrono::time_point tp) _NOEXCEPT { using namespace chrono; if (!lk.owns_lock()) diff --git a/www/cxx1y_status.html b/www/cxx1y_status.html index 42d5c72c..83126a85 100644 --- a/www/cxx1y_status.html +++ b/www/cxx1y_status.html @@ -212,7 +212,7 @@ 2300Redundant sections for map and multimap members should be removedChicagoComplete NB comment: GB9 Remove gets from C++14ChicagoComplete - 2135Unclear requirement for exceptions thrown in condition_variable::wait()Issaquah + 2135Unclear requirement for exceptions thrown in condition_variable::wait()IssaquahComplete 2291std::hash is vulnerable to collision DoS attackIssaquahComplete 2142packaged_task::operator() synchronization too broad?IssaquahComplete 2240Probable misuse of term "function scope" in [thread.condition]IssaquahComplete