From fa3d11f5b1b16193d2c0bbd389d22fd303349e0f Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Thu, 26 May 2016 09:38:54 +0200 Subject: [PATCH] populate simix::Exec ctor --- src/simix/SynchroExec.cpp | 6 ++++++ src/simix/SynchroExec.hpp | 5 +++-- src/simix/smx_host.cpp | 10 ++-------- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/simix/SynchroExec.cpp b/src/simix/SynchroExec.cpp index 3b0f2c84b2..ddd7fc9712 100644 --- a/src/simix/SynchroExec.cpp +++ b/src/simix/SynchroExec.cpp @@ -7,6 +7,12 @@ #include "src/surf/surf_interface.hpp" #include "src/simix/smx_host_private.h" +simgrid::simix::Exec::Exec(const char*name, sg_host_t hostarg) +{ + name = xbt_strdup(name); + state = SIMIX_RUNNING; + host = hostarg; +} simgrid::simix::Exec::~Exec() { if (surf_exec) diff --git a/src/simix/SynchroExec.hpp b/src/simix/SynchroExec.hpp index 20d26f818f..58951ce1b0 100644 --- a/src/simix/SynchroExec.hpp +++ b/src/simix/SynchroExec.hpp @@ -15,13 +15,14 @@ namespace simix { XBT_PUBLIC_CLASS Exec : public Synchro { ~Exec(); public: + Exec(const char*name, sg_host_t host); void suspend() override; void resume() override; void post() override; double remains(); - sg_host_t host; /* The host where the execution takes place */ - surf_action_t surf_exec; /* The Surf execution action encapsulated */ + sg_host_t host; /* The host where the execution takes place. If NULL, then this is a parallel exec (and only surf knows the hosts) */ + surf_action_t surf_exec=nullptr;/* The Surf execution action encapsulated */ }; }} // namespace simgrid::simix diff --git a/src/simix/smx_host.cpp b/src/simix/smx_host.cpp index 312708289f..d1d5ddb768 100644 --- a/src/simix/smx_host.cpp +++ b/src/simix/smx_host.cpp @@ -220,10 +220,7 @@ smx_synchro_t SIMIX_execution_start(smx_process_t issuer, const char *name, double flops_amount, double priority, double bound, unsigned long affinity_mask){ /* alloc structures and initialize */ - simgrid::simix::Exec *exec = new simgrid::simix::Exec(); - exec->name = xbt_strdup(name); - exec->state = SIMIX_RUNNING; - exec->host = issuer->host; + simgrid::simix::Exec *exec = new simgrid::simix::Exec(name, issuer->host); /* set surf's action */ if (!MC_is_active() && !MC_record_replay_is_active()) { @@ -257,10 +254,7 @@ smx_synchro_t SIMIX_execution_parallel_start(const char *name, int i; /* alloc structures and initialize */ - simgrid::simix::Exec *exec = new simgrid::simix::Exec(); - exec->name = xbt_strdup(name); - exec->state = SIMIX_RUNNING; - exec->host = nullptr; /* FIXME: do we need the list of hosts? */ + simgrid::simix::Exec *exec = new simgrid::simix::Exec(name, nullptr); /* set surf's synchro */ host_list_cpy = xbt_new0(sg_host_t, host_nb); -- 2.20.1