[PPL-devel] [GIT] ppl/ppl(master): Now we throw/ catch ad hoc exceptions for deterministic timeouts.

Enea Zaffanella zaffanella at cs.unipr.it
Mon Jul 13 09:41:43 CEST 2009


Module: ppl/ppl
Branch: master
Commit: d81e62914cdeefc5bef56decf96c38376f7ce455
URL:    http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=d81e62914cdeefc5bef56decf96c38376f7ce455

Author: Enea Zaffanella <zaffanella at cs.unipr.it>
Date:   Mon Jul 13 08:56:27 2009 +0200

Now we throw/catch ad hoc exceptions for deterministic timeouts.

---

 interfaces/C/ppl_c_implementation_common.defs.hh |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/interfaces/C/ppl_c_implementation_common.defs.hh b/interfaces/C/ppl_c_implementation_common.defs.hh
index fe4db96..11163fa 100644
--- a/interfaces/C/ppl_c_implementation_common.defs.hh
+++ b/interfaces/C/ppl_c_implementation_common.defs.hh
@@ -104,12 +104,23 @@ public:
   int priority() const {
     return 0;
   }
-  timeout_exception() {
-  }
 };
 
 void reset_timeout();
 
+class deterministic_timeout_exception
+  : public Parma_Polyhedra_Library::Throwable {
+public:
+  void throw_me() const {
+    throw *this;
+  }
+  int priority() const {
+    return 0;
+  }
+};
+
+void reset_deterministic_timeout();
+
 } // namespace C
 
 } // namespace Interfaces
@@ -136,6 +147,11 @@ catch (timeout_exception&) { \
   notify_error(PPL_TIMEOUT_EXCEPTION, "PPL timeout expired"); \
   return PPL_TIMEOUT_EXCEPTION; \
 } \
+catch (deterministic_timeout_exception&) { \
+  reset_deterministic_timeout(); \
+  notify_error(PPL_TIMEOUT_EXCEPTION, "PPL deterministic timeout expired"); \
+  return PPL_TIMEOUT_EXCEPTION; \
+} \
 catch (...) { \
   notify_error(PPL_ERROR_UNEXPECTED_ERROR, \
 	       "completely unexpected error: a bug in the PPL"); \




More information about the PPL-devel mailing list