}
/******************************** Process ************************************/
-
/** @brief Creates and runs a new #msg_process_t.
*
* Does exactly the same as #MSG_process_create_with_arguments but without providing standard arguments
int argc, char **argv, xbt_dict_t properties)
{
xbt_assert(host != nullptr, "Invalid parameters: host param must not be nullptr");
-
simgrid::simix::ActorCode function;
if (code)
function = simgrid::xbt::wrap_main(code, argc, static_cast<const char* const*>(argv));
props[key] = value;
xbt_dict_free(&properties);
- smx_actor_t self = SIMIX_process_self();
- smx_actor_t actor = nullptr;
+ simgrid::s4u::ActorPtr actor = nullptr;
try {
- actor = simgrid::simix::simcall([name, function, data, host, &props, self] {
- return simgrid::kernel::actor::ActorImpl::create(std::move(name), std::move(function), data, host, &props, self)
- .get();
- });
+ actor = simgrid::s4u::Actor::init(std::move(name), host);
+ actor->extension<simgrid::msg::ActorUserData>()->set_user_data(data);
+ actor->start(std::move(function));
} catch (simgrid::HostFailureException const&) {
xbt_die("Could not create a new process on failed host %s.", host->get_cname());
}
return nullptr;
MSG_process_yield();
- return actor->ciface();
+ return actor.get();
}
/** @brief Returns the user data of a process.
xbt_assert(process != nullptr, "Invalid parameter: first parameter must not be nullptr!");
/* get from SIMIX the MSG process data, and then the user data */
- return process->get_impl()->get_user_data();
+ return process->extension<simgrid::msg::ActorUserData>()->get_user_data();
}
/** @brief Sets the user data of a process.
msg_error_t MSG_process_set_data(msg_process_t process, void *data)
{
xbt_assert(process != nullptr, "Invalid parameter: first parameter must not be nullptr!");
-
- process->get_impl()->set_user_data(data);
+ process->extension<simgrid::msg::ActorUserData>()->set_user_data(data);
return MSG_OK;
}