Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Display a msg when contexts are killed by uncatched exceptions
[simgrid.git] / src / kernel / context / Context.hpp
index dd4e482c665761b0550690f214bc44edca18fbb0..ac073aba41001807a61226a360838a3d87df9047 100644 (file)
@@ -58,13 +58,21 @@ public:
   class StopRequest {
     /** @brief Exception launched to kill a process, in order to properly unwind its stack and release RAII stuff
      *
-     * Nope, Sonar, this should not inherit of std::exception.
+     * Nope, Sonar, this should not inherit of std::exception nor of simgrid::Exception.
      * Otherwise, users may accidentally catch it with a try {} catch (std::exception)
      */
+  public:
+    StopRequest() = default;
+    StopRequest(std::string msg) : msg_(msg) { }
+  private:
+    std::string msg_;
   };
   bool iwannadie;
 
   Context(std::function<void()> code, void_pfn_smxprocess_t cleanup_func, smx_actor_t process);
+  Context(const Context&) = delete;
+  Context& operator=(const Context&) = delete;
+
   void operator()() { code_(); }
   bool has_code() const { return static_cast<bool>(code_); }
   smx_actor_t process() { return this->process_; }