Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Derive custom exception from std::exception.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Fri, 22 Sep 2017 09:36:52 +0000 (11:36 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Fri, 22 Sep 2017 09:37:04 +0000 (11:37 +0200)
src/kernel/context/Context.hpp
src/kernel/context/ContextBoost.cpp

index 41e1f8f..a60ea33 100644 (file)
@@ -6,6 +6,7 @@
 #ifndef SIMGRID_KERNEL_CONTEXT_CONTEXT_HPP
 #define SIMGRID_KERNEL_CONTEXT_CONTEXT_HPP
 
+#include <exception>
 #include <functional>
 #include <memory>
 #include <unordered_map>
@@ -80,7 +81,7 @@ namespace context {
     void_pfn_smxprocess_t cleanup_func_ = nullptr;
     smx_actor_t process_ = nullptr;
   public:
-    class StopRequest {
+    class StopRequest : public std::exception {
     };
     bool iwannadie;
 
index a4c78b3..d597a45 100644 (file)
@@ -138,7 +138,7 @@ void BoostContext::smx_ctx_boost_wrapper(BoostContext::ctx_arg_type arg)
   try {
     (*context)();
     context->stop();
-  } catch (StopRequest) {
+  } catch (const StopRequest&) {
     XBT_DEBUG("Caught a StopRequest");
   }
   context->suspend();