Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
[simgrid.git] / src / simix / smx_host.cpp
index 3127082..3b17a20 100644 (file)
@@ -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()) {
@@ -243,7 +240,7 @@ smx_synchro_t SIMIX_execution_start(smx_process_t issuer, const char *name,
     }
   }
 
-  XBT_DEBUG("Create execute synchro %p: %s", exec, exec->name);
+  XBT_DEBUG("Create execute synchro %p: %s", exec, exec->name.c_str());
 
   return exec;
 }
@@ -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);
@@ -324,7 +318,7 @@ void simcall_HANDLER_execution_wait(smx_simcall_t simcall, smx_synchro_t synchro
   XBT_DEBUG("Wait for execution of synchro %p, state %d", synchro, (int)synchro->state);
 
   /* Associate this simcall to the synchro */
-  xbt_fifo_push(synchro->simcalls, simcall);
+  synchro->simcalls.push_back(simcall);
   simcall->issuer->waiting_synchro = synchro;
 
   /* set surf's synchro */
@@ -341,11 +335,7 @@ void simcall_HANDLER_execution_wait(smx_simcall_t simcall, smx_synchro_t synchro
 
 void SIMIX_execution_finish(simgrid::simix::Exec *exec)
 {
-  xbt_fifo_item_t item;
-  smx_simcall_t simcall;
-
-  xbt_fifo_foreach(exec->simcalls, item, simcall, smx_simcall_t) {
-
+  for (smx_simcall_t simcall : exec->simcalls) {
     switch (exec->state) {
 
       case SIMIX_DONE: