X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/06be38ef613115769d3724faf9df315dd9a34957..5e7d79b763a5f55d1afb579d2b5a8d30ccfe869c:/src/simix/ActorImpl.cpp diff --git a/src/simix/ActorImpl.cpp b/src/simix/ActorImpl.cpp index b93d87482e..bf3a1bf874 100644 --- a/src/simix/ActorImpl.cpp +++ b/src/simix/ActorImpl.cpp @@ -146,7 +146,8 @@ void SIMIX_process_empty_trash() namespace simgrid { -namespace simix { +namespace kernel { +namespace actor { ActorImpl::~ActorImpl() { @@ -182,7 +183,7 @@ simgrid::s4u::Actor* ActorImpl::restart() // retrieve the arguments of the old process // FIXME: Factorize this with SIMIX_host_add_auto_restart_process ? - simgrid::simix::ProcessArg arg; + simgrid::kernel::actor::ProcessArg arg; arg.name = name; arg.code = code; arg.host = host; @@ -254,7 +255,7 @@ smx_activity_t ActorImpl::sleep(double duration) simgrid::kernel::activity::SleepImpl* synchro = new simgrid::kernel::activity::SleepImpl(); synchro->host = host; synchro->surf_sleep = host->pimpl_cpu->sleep(duration); - synchro->surf_sleep->setData(synchro); + synchro->surf_sleep->set_data(synchro); XBT_DEBUG("Create sleep synchronization %p", synchro); return synchro; @@ -264,7 +265,7 @@ void create_maestro(std::function code) { smx_actor_t maestro = nullptr; /* Create maestro process and initialize it */ - maestro = new simgrid::simix::ActorImpl(); + maestro = new simgrid::kernel::actor::ActorImpl(); maestro->pid = simix_process_maxpid++; maestro->name = ""; maestro->userdata = nullptr; @@ -281,13 +282,14 @@ void create_maestro(std::function code) simix_global->maestro_process = maestro; } +} // namespace actor } } /** @brief Creates and runs the maestro process */ void SIMIX_maestro_create(void (*code)(void*), void* data) { - simgrid::simix::create_maestro(std::bind(code, data)); + simgrid::kernel::actor::create_maestro(std::bind(code, data)); } /** @@ -310,7 +312,7 @@ smx_actor_t SIMIX_process_create(const char* name, std::function code, v return nullptr; } - smx_actor_t process = new simgrid::simix::ActorImpl(); + smx_actor_t process = new simgrid::kernel::actor::ActorImpl(); xbt_assert(code && host != nullptr, "Invalid parameters"); /* Process data */ @@ -349,8 +351,8 @@ smx_actor_t SIMIX_process_create(const char* name, std::function code, v simix_global->process_to_run.push_back(process); intrusive_ptr_add_ref(process); /* Tracing the process creation */ - TRACE_msg_process_create(process->getName(), process->pid, process->host); - + if (TRACE_actor_is_enabled()) + simgrid::instr::Container::byName(process->host->getName())->createChild(instr_pid(process->ciface()), "ACTOR"); /* The onCreation() signal must be delayed until there, where the pid and everything is set */ simgrid::s4u::ActorPtr tmp = process->iface(); // Passing this directly to onCreation will lead to crashes simgrid::s4u::Actor::onCreation(tmp); @@ -372,7 +374,7 @@ smx_actor_t SIMIX_process_attach(const char* name, void* data, const char* hostn return nullptr; } - smx_actor_t process = new simgrid::simix::ActorImpl(); + smx_actor_t process = new simgrid::kernel::actor::ActorImpl(); /* Process data */ process->pid = simix_process_maxpid++; process->name = std::string(name); @@ -407,7 +409,8 @@ smx_actor_t SIMIX_process_attach(const char* name, void* data, const char* hostn intrusive_ptr_add_ref(process); /* Tracing the process creation */ - TRACE_msg_process_create(process->getName(), process->pid, process->host); + if (TRACE_actor_is_enabled()) + simgrid::instr::Container::byName(process->host->getName())->createChild(instr_pid(process->ciface()), "ACTOR"); auto* context = dynamic_cast(process->context); if (not context) @@ -748,8 +751,8 @@ void SIMIX_process_yield(smx_actor_t self) std::rethrow_exception(std::move(exception)); } - if(SMPI_switch_data_segment){ - SMPI_switch_data_segment(self->pid); + if (SMPI_switch_data_segment && not self->finished) { + SMPI_switch_data_segment(self->iface()); } }