Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Restore handling of msg_global->process_data_cleanup.
[simgrid.git] / src / msg / msg_global.cpp
index 20b55df..d8e0f77 100644 (file)
@@ -42,6 +42,12 @@ void MSG_init_nocheck(int *argc, char **argv) {
     msg_global->sent_msg = 0;
     msg_global->task_copy_callback = nullptr;
     msg_global->process_data_cleanup = nullptr;
+    simgrid::s4u::Actor::on_termination.connect([](simgrid::s4u::Actor const& actor) {
+      // free the data if a function was provided
+      void* userdata = sg_actor_data(&actor);
+      if (userdata && msg_global->process_data_cleanup)
+        msg_global->process_data_cleanup(userdata);
+    });
   }
 
   if(MC_is_active()){