Author: aconway
Date: Fri Jul 18 18:15:45 2014
New Revision: 1611745
URL: http://svn.apache.org/r1611745
Log:
No-JIRA: Get rid of throw in destructor for ~Waitable.
Modified:
qpid/trunk/qpid/cpp/src/qpid/sys/Waitable.h
Modified: qpid/trunk/qpid/cpp/src/qpid/sys/Waitable.h
URL:
http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/sys/Waitable.h?rev=1611745&r1=1611744&r2=1611745&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/sys/Waitable.h (original)
+++ qpid/trunk/qpid/cpp/src/qpid/sys/Waitable.h Fri Jul 18 18:15:45 2014
@@ -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;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]