summaryrefslogtreecommitdiff
path: root/qpid/cpp
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2014-07-18 18:15:45 +0000
committerAlan Conway <aconway@apache.org>2014-07-18 18:15:45 +0000
commit079c56b640cf6bc9f83de281191a46240303dcf8 (patch)
treea46bf5e425d6e0ca94c7f4df0fe9a9ad36229276 /qpid/cpp
parent5765f0e29b2d14a923ec4d34bc847295f4a57353 (diff)
downloadqpid-python-079c56b640cf6bc9f83de281191a46240303dcf8.tar.gz
No-JIRA: Get rid of throw in destructor for ~Waitable.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1611745 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp')
-rw-r--r--qpid/cpp/src/qpid/sys/Waitable.h26
1 files changed, 8 insertions, 18 deletions
diff --git a/qpid/cpp/src/qpid/sys/Waitable.h b/qpid/cpp/src/qpid/sys/Waitable.h
index 479465a59a..912cb3a2d9 100644
--- a/qpid/cpp/src/qpid/sys/Waitable.h
+++ b/qpid/cpp/src/qpid/sys/Waitable.h
@@ -25,21 +25,15 @@
#include "qpid/sys/ExceptionHolder.h"
#include <assert.h>
-#if __cplusplus >=201103L
-#define DESTRUCTOR_THROWS noexcept(false)
-#else
-#define DESTRUCTOR_THROWS
-#endif
-
namespace qpid {
namespace sys {
/**
* A monitor that keeps track of waiting threads. Threads declare a
* ScopedWait around wait() inside a ScopedLock to be considered
- * waiters.
+ * waiters.
*
- * Allows waiting threads to be interrupted by an exception.
+ * Allows waiting threads to be interrupted by an exception.
*/
class Waitable : public Monitor {
public:
@@ -62,7 +56,7 @@ class Waitable : public Monitor {
*@pre Must be called inside a ScopedLock but NOT a ScopedWait.
*/
void waitWaiters() {
- while (waiters != 0)
+ while (waiters != 0)
Monitor::wait();
}
@@ -79,7 +73,7 @@ class Waitable : public Monitor {
void setException(const ExceptionHolder& e) {
exception = e;
notifyAll();
-
+
}
/** True if the waitable has an exception */
@@ -93,23 +87,19 @@ class Waitable : public Monitor {
/** Throws an exception if one is set before or during the wait. */
void wait() {
- ExCheck e(exception);
+ exception.raise();
Monitor::wait();
+ exception.raise();
}
/** Throws an exception if one is set before or during the wait. */
bool wait(const AbsTime& absoluteTime) {
- ExCheck e(exception);
+ exception.raise();
return Monitor::wait(absoluteTime);
+ exception.raise();
}
private:
- struct ExCheck {
- const ExceptionHolder& exception;
- ExCheck(const ExceptionHolder& e) : exception(e) { e.raise(); }
- ~ExCheck() DESTRUCTOR_THROWS { exception.raise(); }
- };
-
size_t waiters;
ExceptionHolder exception;