/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
+#include "mc/mc.h"
#include "simgrid/s4u/Engine.hpp"
#include "simgrid/s4u/Host.hpp"
-
-#include "mc/mc.h"
#include "src/instr/instr_private.hpp"
#include "src/msg/msg_private.hpp"
+#include "src/simix/smx_private.hpp"
#include <xbt/config.hpp>
XBT_LOG_NEW_CATEGORY(msg, "All MSG categories");
msg_global->task_copy_callback = nullptr;
msg_global->process_data_cleanup = nullptr;
- SIMIX_function_register_process_create(MSG_process_create_from_SIMIX);
- SIMIX_function_register_process_cleanup(MSG_process_cleanup_from_SIMIX);
+ simgrid::s4u::Actor::on_destruction.connect([](simgrid::s4u::ActorPtr actor) {
+ // free the data if a function was provided
+ void* userdata = actor->get_impl()->get_user_data();
+ if (userdata && msg_global->process_data_cleanup) {
+ msg_global->process_data_cleanup(userdata);
+ }
+ });
}
if(MC_is_active()){
XBT_PUBLIC_DATA MSG_Global_t msg_global;
/*************************************************************/
-XBT_PRIVATE void MSG_process_cleanup_from_SIMIX(smx_actor_t smx_proc);
-XBT_PRIVATE smx_actor_t MSG_process_create_from_SIMIX(std::string name, simgrid::simix::ActorCode code, void* data,
- sg_host_t host,
- std::unordered_map<std::string, std::string>* properties,
- smx_actor_t parent_process);
XBT_PRIVATE void MSG_comm_copy_data_from_SIMIX(smx_activity_t comm, void* buff, size_t buff_size);
/********** Tracing **********/
}
/******************************** Process ************************************/
-/**
- * @brief Cleans the MSG data of an actor
- * @param smx_actor a SIMIX actor
- */
-void MSG_process_cleanup_from_SIMIX(smx_actor_t smx_actor)
-{
- // free the data if a function was provided
- void* userdata = smx_actor->get_user_data();
- if (userdata && msg_global->process_data_cleanup) {
- msg_global->process_data_cleanup(userdata);
- }
-
- SIMIX_process_cleanup(smx_actor);
-}
-
-/* This function creates a MSG process. It has the prototype enforced by SIMIX_function_register_process_create */
-smx_actor_t MSG_process_create_from_SIMIX(std::string name, simgrid::simix::ActorCode code, void* data, sg_host_t host,
- std::unordered_map<std::string, std::string>* properties,
- smx_actor_t /*parent_process*/)
-{
- msg_process_t p = MSG_process_create_from_stdfunc(name, std::move(code), data, host, properties);
- return p == nullptr ? nullptr : p->get_impl();
-}
/** @brief Creates and runs a new #msg_process_t.
*