#ifndef SIMGRID_S4U_ACTOR_HPP
#define SIMGRID_S4U_ACTOR_HPP
+#include <functional>
#include <simgrid/chrono.hpp>
#include <xbt/Extendable.hpp>
#include <xbt/functional.hpp>
* executed when your actor is killed. You should use them to free the data used by your actor.
*/
void on_exit(int_f_pvoid_pvoid_t fun, void* data);
+ void on_exit(std::function<void(int, void*)> fun, void* data);
/** Sets the time at which that actor should be killed */
void set_kill_time(double time);
/** @brief Add a function to the list of "on_exit" functions. */
XBT_PUBLIC void on_exit(int_f_pvoid_pvoid_t fun, void* data);
+XBT_PUBLIC void on_exit(std::function<void(int, void*)> fun, void* data);
/** @brief Migrate the actor to a new host. */
XBT_PUBLIC void migrate(Host* new_host);
simgrid::simix::simcall([this, fun, data] { SIMIX_process_on_exit(pimpl_, fun, data); });
}
+void Actor::on_exit(std::function<void(int, void*)> fun, void* data)
+{
+ simgrid::simix::simcall([this, fun, data] { SIMIX_process_on_exit(pimpl_, fun, data); });
+}
+
/** @brief Moves the actor to another host
*
* If the actor is currently blocked on an execution activity, the activity is also
SIMIX_process_self()->iface()->on_exit(fun, data);
}
+void on_exit(std::function<void(int, void*)> fun, void* data)
+{
+ SIMIX_process_self()->iface()->on_exit(fun, data);
+}
+
/** @brief Moves the current actor to another host
*
* @see simgrid::s4u::Actor::migrate() for more information