* std::map<std::string, std::string>* props: properties
*/
typedef smx_actor_t (*smx_creation_func_t)(
- /* name */ const char*, std::function<void()> code,
+ /* name */ const char*, simgrid::simix::ActorCode code,
/* userdata */ void*,
/* hostname */ sg_host_t,
/* props */ std::unordered_map<std::string, std::string>*,
XBT_PUBLIC void SIMIX_function_register_process_create(smx_creation_func_t function);
-XBT_PUBLIC smx_actor_t simcall_process_create(const char* name, std::function<void()> code, void* data, sg_host_t host,
+XBT_PUBLIC smx_actor_t simcall_process_create(const char* name, simgrid::simix::ActorCode code, void* data, sg_host_t host,
std::unordered_map<std::string, std::string>* properties);
XBT_PUBLIC smx_timer_t SIMIX_timer_set(double date, simgrid::xbt::Task<void()> callback);
/*************************************************************/
XBT_PRIVATE void MSG_process_cleanup_from_SIMIX(smx_actor_t smx_proc);
-XBT_PRIVATE smx_actor_t MSG_process_create_from_SIMIX(const char* name, std::function<void()> code, void* data,
+XBT_PRIVATE smx_actor_t MSG_process_create_from_SIMIX(const char* name, simgrid::simix::ActorCode code, void* data,
sg_host_t host,
std::unordered_map<std::string, std::string>* properties,
smx_actor_t parent_process);
}
/* 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(const char* name, std::function<void()> code, void* data, sg_host_t host,
+smx_actor_t MSG_process_create_from_SIMIX(const char* 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 MSG_process_create_with_environment(const char *name, xbt_main_func_t code, void *data, msg_host_t host,
int argc, char **argv, xbt_dict_t properties)
{
- std::function<void()> function;
+ simgrid::simix::ActorCode function;
if (code)
function = simgrid::xbt::wrap_main(code, argc, static_cast<const char* const*>(argv));
return res;
}
-msg_process_t MSG_process_create_from_stdfunc(const char* name, std::function<void()> code, void* data, msg_host_t host,
+msg_process_t MSG_process_create_from_stdfunc(const char* name, simgrid::simix::ActorCode code, void* data, msg_host_t host,
std::unordered_map<std::string, std::string>* properties)
{
xbt_assert(code != nullptr && host != nullptr, "Invalid parameters: host and code params must not be nullptr");
return synchro;
}
-void create_maestro(std::function<void()> code)
+void create_maestro(simgrid::simix::ActorCode code)
{
smx_actor_t maestro = nullptr;
/* Create maestro process and initialize it */
maestro->setUserData(nullptr);
if (not code) {
- maestro->context = SIMIX_context_new(std::function<void()>(), nullptr, maestro);
+ maestro->context = SIMIX_context_new(simgrid::simix::ActorCode(), nullptr, maestro);
} else {
if (not simix_global)
xbt_die("simix is not initialized, please call MSG_init first");
*
* \return the process created
*/
-smx_actor_t SIMIX_process_create(const char* name, std::function<void()> code, void* data, simgrid::s4u::Host* host,
+smx_actor_t SIMIX_process_create(const char* name, simgrid::simix::ActorCode code, void* data, simgrid::s4u::Host* host,
std::unordered_map<std::string, std::string>* properties, smx_actor_t parent_process)
{
return res;
}
-smx_actor_t simcall_process_create(const char* name, std::function<void()> code, void* data, sg_host_t host,
+smx_actor_t simcall_process_create(const char* name, simgrid::simix::ActorCode code, void* data, sg_host_t host,
std::unordered_map<std::string, std::string>* properties)
{
if (name == nullptr)
class ProcessArg {
public:
std::string name;
- std::function<void()> code;
+ simgrid::simix::ActorCode code;
void* data = nullptr;
s4u::Host* host = nullptr;
double kill_time = 0.0;
std::shared_ptr<std::unordered_map<std::string, std::string>> properties;
bool auto_restart = false;
ProcessArg() = default;
- explicit ProcessArg(std::string name, std::function<void()> code, void* data, s4u::Host* host, double kill_time,
+ explicit ProcessArg(std::string name, simgrid::simix::ActorCode code, void* data, s4u::Host* host, double kill_time,
std::shared_ptr<std::unordered_map<std::string, std::string>> properties, bool auto_restart)
: name(name)
, code(std::move(code))
s_smx_simcall simcall;
std::vector<s_smx_process_exit_fun_t> on_exit; /* list of functions executed when the process dies */
- std::function<void()> code;
+ simgrid::simix::ActorCode code;
smx_timer_t kill_timer = nullptr;
private:
&ActorImpl::smx_synchro_hook>>
SynchroList;
-XBT_PUBLIC void create_maestro(std::function<void()> code);
+XBT_PUBLIC void create_maestro(simgrid::simix::ActorCode code);
}
} // namespace kernel
} // namespace simgrid
typedef simgrid::kernel::actor::ActorImpl* smx_actor_t;
-XBT_PRIVATE smx_actor_t SIMIX_process_create(const char* name, std::function<void()> code, void* data, sg_host_t host,
+XBT_PRIVATE smx_actor_t SIMIX_process_create(const char* name, simgrid::simix::ActorCode code, void* data, sg_host_t host,
std::unordered_map<std::string, std::string>* properties,
smx_actor_t parent_process);
}
}
-static std::function<void()> maestro_code;
+static simgrid::simix::ActorCode maestro_code;
void SIMIX_set_maestro(void (*code)(void*), void* data)
{
#ifdef _WIN32
* The processes will only be restarted once, meaning that you will have to register the process
* again to restart the process again.
*/
-void SIMIX_host_add_auto_restart_process(sg_host_t host, const char* name, std::function<void()> code, void* data,
+void SIMIX_host_add_auto_restart_process(sg_host_t host, const char* name, simgrid::simix::ActorCode code, void* data,
double kill_time, std::unordered_map<std::string, std::string>* properties,
int auto_restart)
{
bool auto_restart = actor->on_failure != simgrid::kernel::routing::ActorOnFailure::DIE;
std::string actor_name = actor->args[0];
- std::function<void()> code = factory(std::move(actor->args));
+ simgrid::simix::ActorCode code = factory(std::move(actor->args));
std::shared_ptr<std::unordered_map<std::string, std::string>> properties(actor->properties);
simgrid::kernel::actor::ProcessArg* arg =