msg_actor = (simgrid::msg::ActorExt*)SIMIX_process_self_get_data();
SIMIX_process_self_set_data(nullptr);
} else {
- msg_actor = (simgrid::msg::ActorExt*)smx_actor->data;
+ msg_actor = (simgrid::msg::ActorExt*)smx_actor->userdata;
simcall_process_set_data(smx_actor, nullptr);
}
xbt_assert(process != nullptr, "Invalid parameter: first parameter must not be nullptr!");
/* get from SIMIX the MSG process data, and then the user data */
- simgrid::msg::ActorExt* msgExt = (simgrid::msg::ActorExt*)process->getImpl()->data;
+ simgrid::msg::ActorExt* msgExt = (simgrid::msg::ActorExt*)process->getImpl()->userdata;
if (msgExt)
return msgExt->data;
else
{
xbt_assert(process != nullptr, "Invalid parameter: first parameter must not be nullptr!");
- static_cast<simgrid::msg::ActorExt*>(process->getImpl()->data)->data = data;
+ static_cast<simgrid::msg::ActorExt*>(process->getImpl()->userdata)->data = data;
return MSG_OK;
}
arg.code = code;
arg.host = host;
arg.kill_time = SIMIX_timer_get_date(kill_timer);
- arg.data = data;
+ arg.data = userdata;
arg.properties = nullptr;
arg.auto_restart = auto_restart;
maestro = new simgrid::simix::ActorImpl();
maestro->pid = simix_process_maxpid++;
maestro->name = "";
- maestro->data = nullptr;
+ maestro->userdata = nullptr;
if (not code) {
maestro->context = SIMIX_context_new(std::function<void()>(), nullptr, maestro);
process->pid = simix_process_maxpid++;
process->name = simgrid::xbt::string(name);
process->host = host;
- process->data = data;
+ process->userdata = data;
process->simcall.issuer = process;
if (parent_process != nullptr) {
process->pid = simix_process_maxpid++;
process->name = std::string(name);
process->host = host;
- process->data = data;
+ process->userdata = data;
process->simcall.issuer = process;
if (parent_process != nullptr) {
if (not self) {
return nullptr;
}
- return self->data;
+ return self->getUserData();
}
void SIMIX_process_self_set_data(void *data)
{
- smx_actor_t self = SIMIX_process_self();
-
- SIMIX_process_set_data(self, data);
+ SIMIX_process_self()->setUserData(data);
}
-void SIMIX_process_set_data(smx_actor_t process, void *data)
-{
- process->data = data;
-}
/* needs to be public and without simcall because it is called
by exceptions and logging events */
SIMIX_process_on_exit_runall(self);
/* Add the process to the list of process to restart, only if the host is down */
if (self->auto_restart && self->host->isOff()) {
- SIMIX_host_add_auto_restart_process(self->host, self->cname(),
- self->code, self->data,
- SIMIX_timer_get_date(self->kill_timer),
- self->properties,
- self->auto_restart);
+ SIMIX_host_add_auto_restart_process(self->host, self->cname(), self->code, self->userdata,
+ SIMIX_timer_get_date(self->kill_timer), self->properties, self->auto_restart);
}
XBT_DEBUG("Process %s@%s is dead", self->cname(), self->host->getCname());
self->context->stop();
std::list<smx_activity_t> comms; /* the current non-blocking communication synchros */
xbt_dict_t properties = nullptr;
s_smx_simcall_t simcall;
- void *data = nullptr; /* kept for compatibility, it should be replaced with moddata */
+ void* userdata = nullptr; /* kept for compatibility, it should be replaced with moddata */
std::vector<s_smx_process_exit_fun_t> on_exit; /* list of functions executed when the process dies */
std::function<void()> code;
smx_activity_t suspend(ActorImpl* issuer);
void resume();
smx_activity_t sleep(double duration);
+ void setUserData(void* data) { userdata = data; }
+ void* getUserData() { return userdata; }
};
}
*/
void simcall_process_set_data(smx_actor_t process, void *data)
{
- simgrid::simix::kernelImmediate(std::bind(SIMIX_process_set_data, process, data));
+ simgrid::simix::kernelImmediate([process, data] { process->setUserData(data); });
}
/**
smx_actor_t me = SIMIX_process_self();
if (me == nullptr) // This happens sometimes (eg, when linking against NS3 because it pulls openMPI...)
return nullptr;
- simgrid::msg::ActorExt* msgExt = static_cast<simgrid::msg::ActorExt*>(me->data);
+ simgrid::msg::ActorExt* msgExt = static_cast<simgrid::msg::ActorExt*>(me->userdata);
return static_cast<simgrid::smpi::Process*>(msgExt->data);
}
XBT_DEBUG("Privatization : We are copying from a zone inside global memory... Saving data to temp buffer !");
smpi_switch_data_segment(
- static_cast<simgrid::smpi::Process*>((static_cast<simgrid::msg::ActorExt*>(comm->src_proc->data)->data))
+ static_cast<simgrid::smpi::Process*>((static_cast<simgrid::msg::ActorExt*>(comm->src_proc->userdata)->data))
->index());
tmpbuff = static_cast<void*>(xbt_malloc(buff_size));
memcpy_private(tmpbuff, buff, private_blocks);
&& ((char*)comm->dst_buff < smpi_start_data_exe + smpi_size_data_exe )){
XBT_DEBUG("Privatization : We are copying to a zone inside global memory - Switch data segment");
smpi_switch_data_segment(
- static_cast<simgrid::smpi::Process*>((static_cast<simgrid::msg::ActorExt*>(comm->dst_proc->data)->data))
+ static_cast<simgrid::smpi::Process*>((static_cast<simgrid::msg::ActorExt*>(comm->dst_proc->userdata)->data))
->index());
}
XBT_DEBUG("Copying %zu bytes from %p to %p", buff_size, tmpbuff,comm->dst_buff);
instance_id_ = instance_id;
index_ = index;
- static_cast<simgrid::msg::ActorExt*>(SIMIX_process_self()->data)->data = this;
+ static_cast<simgrid::msg::ActorExt*>(SIMIX_process_self()->userdata)->data = this;
if (*argc > 3) {
memmove(&(*argv)[0], &(*argv)[2], sizeof(char *) * (*argc - 2));