From: Arnaud Giersch Date: Fri, 22 Sep 2017 09:36:52 +0000 (+0200) Subject: Derive custom exception from std::exception. X-Git-Tag: v3_17~88 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/7198a3162eaae82fa2ec5c612d5ae22e243055d7 Derive custom exception from std::exception. --- diff --git a/src/kernel/context/Context.hpp b/src/kernel/context/Context.hpp index 41e1f8fae2..a60ea33971 100644 --- a/src/kernel/context/Context.hpp +++ b/src/kernel/context/Context.hpp @@ -6,6 +6,7 @@ #ifndef SIMGRID_KERNEL_CONTEXT_CONTEXT_HPP #define SIMGRID_KERNEL_CONTEXT_CONTEXT_HPP +#include #include #include #include @@ -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; diff --git a/src/kernel/context/ContextBoost.cpp b/src/kernel/context/ContextBoost.cpp index a4c78b34e0..d597a45142 100644 --- a/src/kernel/context/ContextBoost.cpp +++ b/src/kernel/context/ContextBoost.cpp @@ -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();