Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Make sure that the dtor of CheckerSide actually kills the application and waits for it
[simgrid.git] / src / mc / remote / CheckerSide.hpp
index 40e74c5..17fb33c 100644 (file)
@@ -18,12 +18,8 @@ namespace simgrid::mc {
 /* CheckerSide: All what the checker needs to interact with a given application process */
 
 class CheckerSide {
-  void (*const free_event_fun)(event*) = [](event* evt) {
-    event_del(evt);
-    event_free(evt);
-  };
-  std::unique_ptr<event, decltype(&event_free)> socket_event_{nullptr, free_event_fun};
-  std::unique_ptr<event, decltype(&event_free)> signal_event_{nullptr, free_event_fun};
+  event* socket_event_;
+  event* signal_event_;
   std::unique_ptr<event_base, decltype(&event_base_free)> base_{nullptr, &event_base_free};
   std::unique_ptr<RemoteProcessMemory> remote_memory_;
 
@@ -36,7 +32,8 @@ class CheckerSide {
   void handle_waitpid();
 
 public:
-  explicit CheckerSide(const std::vector<char*>& args);
+  explicit CheckerSide(const std::vector<char*>& args, bool need_memory_introspection);
+  ~CheckerSide();
 
   // No copy:
   CheckerSide(CheckerSide const&) = delete;
@@ -52,11 +49,14 @@ public:
   void break_loop() const;
   void wait_for_requests();
 
+  /** Ask the application to run post-mortem analysis, and maybe to stop ASAP */
+  void finalize(bool terminate_asap = false);
+
   /* Interacting with the application process */
   pid_t get_pid() const { return pid_; }
   bool running() const { return running_; }
   void terminate() { running_ = false; }
-  RemoteProcessMemory& get_remote_memory() { return *remote_memory_.get(); }
+  RemoteProcessMemory* get_remote_memory() { return remote_memory_.get(); }
 };
 
 } // namespace simgrid::mc