Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[simix] DeXFTification of Synchro: use std::list<> instead of xbt_fifo_t
authorGabriel Corona <gabriel.corona@loria.fr>
Tue, 31 May 2016 08:09:27 +0000 (10:09 +0200)
committerGabriel Corona <gabriel.corona@loria.fr>
Tue, 31 May 2016 09:16:20 +0000 (11:16 +0200)
14 files changed:
include/simgrid/forward.h
src/mc/mc_base.h
src/simix/Synchro.cpp
src/simix/Synchro.h
src/simix/SynchroComm.cpp
src/simix/SynchroExec.cpp
src/simix/SynchroIo.cpp
src/simix/SynchroSleep.cpp
src/simix/popping_private.h
src/simix/smx_host.cpp
src/simix/smx_io.cpp
src/simix/smx_network.cpp
src/simix/smx_process.cpp
src/simix/smx_synchro.cpp

index 437d794..3e2ac32 100644 (file)
@@ -68,6 +68,9 @@ typedef struct s_xbt_dictelm *sg_storage_t;
 
 typedef tmgr_Trace *tmgr_trace_t; /**< Opaque structure defining an availability trace */
 
 
 typedef tmgr_Trace *tmgr_trace_t; /**< Opaque structure defining an availability trace */
 
+typedef struct s_smx_simcall s_smx_simcall_t;
+typedef struct s_smx_simcall* smx_simcall_t;
+
 typedef enum {
   SURF_LINK_FULLDUPLEX = 2,
   SURF_LINK_SHARED = 1,
 typedef enum {
   SURF_LINK_FULLDUPLEX = 2,
   SURF_LINK_SHARED = 1,
index fc1c184..5d9baa0 100644 (file)
@@ -12,9 +12,7 @@
 #endif
 
 #include <xbt/base.h>
 #endif
 
 #include <xbt/base.h>
-
-typedef struct s_smx_simcall  s_smx_simcall_t;
-typedef struct s_smx_simcall* smx_simcall_t;
+#include <simgrid/forward.h>
 
 #ifdef __cplusplus
 
 
 #ifdef __cplusplus
 
index db8d8d6..e64a060 100644 (file)
@@ -5,19 +5,19 @@
 
 #include "src/simix/Synchro.h"
 
 
 #include "src/simix/Synchro.h"
 
-simgrid::simix::Synchro::Synchro() {
-  simcalls = xbt_fifo_new();
+simgrid::simix::Synchro::Synchro()
+{
 }
 
 simgrid::simix::Synchro::~Synchro()
 {
 }
 
 simgrid::simix::Synchro::~Synchro()
 {
-  xbt_fifo_free(simcalls);
 }
 
 void simgrid::simix::Synchro::ref()
 {
   refcount++;
 }
 }
 
 void simgrid::simix::Synchro::ref()
 {
   refcount++;
 }
+
 void simgrid::simix::Synchro::unref()
 {
   xbt_assert(refcount > 0,
 void simgrid::simix::Synchro::unref()
 {
   xbt_assert(refcount > 0,
index da0e8e0..8b3d427 100644 (file)
@@ -7,6 +7,7 @@
 #define _SIMIX_SYNCHRO_HPP
 
 #include <string>
 #define _SIMIX_SYNCHRO_HPP
 
 #include <string>
+#include <list>
 
 #include <xbt/base.h>
 #include "simgrid/forward.h"
 
 #include <xbt/base.h>
 #include "simgrid/forward.h"
@@ -24,8 +25,8 @@ namespace simix {
     virtual ~Synchro();
     e_smx_state_t state = SIMIX_WAITING; /* State of the synchro */
     std::string name;                  /* synchro name if any */
     virtual ~Synchro();
     e_smx_state_t state = SIMIX_WAITING; /* State of the synchro */
     std::string name;                  /* synchro name if any */
-    xbt_fifo_t simcalls = nullptr;     /* List of simcalls waiting for this synchro */
-    char *category = nullptr;          /* For instrumentation */
+    std::list<smx_simcall_t> simcalls; /* List of simcalls waiting for this synchro */
+    char *category;                    /* For instrumentation */
 
     virtual void suspend()=0;
     virtual void resume()=0;
 
     virtual void suspend()=0;
     virtual void resume()=0;
index 4342cb1..994583e 100644 (file)
@@ -133,6 +133,6 @@ void simgrid::simix::Comm::post()
   cleanupSurf();
 
   /* if there are simcalls associated with the synchro, then answer them */
   cleanupSurf();
 
   /* if there are simcalls associated with the synchro, then answer them */
-  if (xbt_fifo_size(simcalls))
+  if (!simcalls.empty())
     SIMIX_comm_finish(this);
 }
     SIMIX_comm_finish(this);
 }
index 2e04846..8ab8f2e 100644 (file)
@@ -59,6 +59,6 @@ void simgrid::simix::Exec::post()
   }
 
   /* If there are simcalls associated with the synchro, then answer them */
   }
 
   /* If there are simcalls associated with the synchro, then answer them */
-  if (xbt_fifo_size(simcalls))
+  if (!simcalls.empty())
     SIMIX_execution_finish(this);
 }
     SIMIX_execution_finish(this);
 }
index dd2f2e2..812bbaf 100644 (file)
@@ -22,10 +22,7 @@ void simgrid::simix::Io::resume()
 
 void simgrid::simix::Io::post()
 {
 
 void simgrid::simix::Io::post()
 {
-  xbt_fifo_item_t i;
-  smx_simcall_t simcall;
-
-  xbt_fifo_foreach(simcalls,i,simcall,smx_simcall_t) {
+  for (smx_simcall_t simcall : simcalls) {
     switch (simcall->call) {
     case SIMCALL_FILE_OPEN: {
       smx_file_t tmp = xbt_new(s_smx_file_t,1);
     switch (simcall->call) {
     case SIMCALL_FILE_OPEN: {
       smx_file_t tmp = xbt_new(s_smx_file_t,1);
index 853dd31..579f06d 100644 (file)
@@ -22,11 +22,11 @@ void simgrid::simix::Sleep::resume()
 
 void simgrid::simix::Sleep::post()
 {
 
 void simgrid::simix::Sleep::post()
 {
-  smx_simcall_t simcall;
-  e_smx_state_t state;
-
-  while ((simcall = (smx_simcall_t) xbt_fifo_shift(simcalls))) {
+  while (!simcalls.empty()) {
+    smx_simcall_t simcall = simcalls.front();
+    simcalls.pop_front();
 
 
+    e_smx_state_t state;
     switch (surf_sleep->getState()){
       case simgrid::surf::Action::State::failed:
         simcall->issuer->context->iwannadie = 1;
     switch (surf_sleep->getState()){
       case simgrid::surf::Action::State::failed:
         simcall->issuer->context->iwannadie = 1;
index e8e76b7..3c33b23 100644 (file)
@@ -42,13 +42,13 @@ union u_smx_scalar {
 /**
  * \brief Represents a simcall to the kernel.
  */
 /**
  * \brief Represents a simcall to the kernel.
  */
-typedef struct s_smx_simcall {
+struct s_smx_simcall {
   e_smx_simcall_t call;
   smx_process_t issuer;
   int mc_value;
   union u_smx_scalar args[11];
   union u_smx_scalar result;
   e_smx_simcall_t call;
   smx_process_t issuer;
   int mc_value;
   union u_smx_scalar args[11];
   union u_smx_scalar result;
-} s_smx_simcall_t, *smx_simcall_t;
+};
 
 #define SIMCALL_SET_MC_VALUE(simcall, value) ((simcall)->mc_value = (value))
 #define SIMCALL_GET_MC_VALUE(simcall) ((simcall)->mc_value)
 
 #define SIMCALL_SET_MC_VALUE(simcall, value) ((simcall)->mc_value = (value))
 #define SIMCALL_GET_MC_VALUE(simcall) ((simcall)->mc_value)
index fee9062..3b17a20 100644 (file)
@@ -318,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_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 */
   simcall->issuer->waiting_synchro = synchro;
 
   /* set surf's synchro */
@@ -335,11 +335,7 @@ void simcall_HANDLER_execution_wait(smx_simcall_t simcall, smx_synchro_t synchro
 
 void SIMIX_execution_finish(simgrid::simix::Exec *exec)
 {
 
 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:
     switch (exec->state) {
 
       case SIMIX_DONE:
index c465d62..c4a1033 100644 (file)
@@ -54,7 +54,7 @@ void SIMIX_storage_destroy(void *s)
 void simcall_HANDLER_file_read(smx_simcall_t simcall, smx_file_t fd, sg_size_t size, sg_host_t host)
 {
   smx_synchro_t synchro = SIMIX_file_read(fd, size, host);
 void simcall_HANDLER_file_read(smx_simcall_t simcall, smx_file_t fd, sg_size_t size, sg_host_t host)
 {
   smx_synchro_t synchro = SIMIX_file_read(fd, size, host);
-  xbt_fifo_push(synchro->simcalls, simcall);
+  synchro->simcalls.push_back(simcall);
   simcall->issuer->waiting_synchro = synchro;
 }
 
   simcall->issuer->waiting_synchro = synchro;
 }
 
@@ -79,7 +79,7 @@ smx_synchro_t SIMIX_file_read(smx_file_t fd, sg_size_t size, sg_host_t host)
 void simcall_HANDLER_file_write(smx_simcall_t simcall, smx_file_t fd, sg_size_t size, sg_host_t host)
 {
   smx_synchro_t synchro = SIMIX_file_write(fd,  size, host);
 void simcall_HANDLER_file_write(smx_simcall_t simcall, smx_file_t fd, sg_size_t size, sg_host_t host)
 {
   smx_synchro_t synchro = SIMIX_file_write(fd,  size, host);
-  xbt_fifo_push(synchro->simcalls, simcall);
+  synchro->simcalls.push_back(simcall);
   simcall->issuer->waiting_synchro = synchro;
 }
 
   simcall->issuer->waiting_synchro = synchro;
 }
 
@@ -101,7 +101,7 @@ smx_synchro_t SIMIX_file_write(smx_file_t fd, sg_size_t size, sg_host_t host)
 void simcall_HANDLER_file_open(smx_simcall_t simcall, const char* fullpath, sg_host_t host)
 {
   smx_synchro_t synchro = SIMIX_file_open(fullpath, host);
 void simcall_HANDLER_file_open(smx_simcall_t simcall, const char* fullpath, sg_host_t host)
 {
   smx_synchro_t synchro = SIMIX_file_open(fullpath, host);
-  xbt_fifo_push(synchro->simcalls, simcall);
+  synchro->simcalls.push_back(simcall);
   simcall->issuer->waiting_synchro = synchro;
 }
 
   simcall->issuer->waiting_synchro = synchro;
 }
 
@@ -123,7 +123,7 @@ smx_synchro_t SIMIX_file_open(const char* fullpath, sg_host_t host)
 void simcall_HANDLER_file_close(smx_simcall_t simcall, smx_file_t fd, sg_host_t host)
 {
   smx_synchro_t synchro = SIMIX_file_close(fd, host);
 void simcall_HANDLER_file_close(smx_simcall_t simcall, smx_file_t fd, sg_host_t host)
 {
   smx_synchro_t synchro = SIMIX_file_close(fd, host);
-  xbt_fifo_push(synchro->simcalls, simcall);
+  synchro->simcalls.push_back(simcall);
   simcall->issuer->waiting_synchro = synchro;
 }
 
   simcall->issuer->waiting_synchro = synchro;
 }
 
@@ -264,10 +264,7 @@ void SIMIX_io_destroy(smx_synchro_t synchro)
 
 void SIMIX_io_finish(smx_synchro_t synchro)
 {
 
 void SIMIX_io_finish(smx_synchro_t synchro)
 {
-  xbt_fifo_item_t item;
-  smx_simcall_t simcall;
-
-  xbt_fifo_foreach(synchro->simcalls, item, simcall, smx_simcall_t) {
+  for (smx_simcall_t simcall : synchro->simcalls) {
 
     switch (synchro->state) {
 
 
     switch (synchro->state) {
 
index 569d72f..7856a90 100644 (file)
@@ -3,6 +3,8 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
+#include <boost/range/algorithm.hpp>
+
 #include "src/surf/surf_interface.hpp"
 #include "src/simix/smx_private.h"
 #include "xbt/log.h"
 #include "src/surf/surf_interface.hpp"
 #include "src/simix/smx_private.h"
 #include "xbt/log.h"
@@ -384,7 +386,7 @@ void simcall_HANDLER_comm_wait(smx_simcall_t simcall, smx_synchro_t synchro, dou
   /* Associate this simcall to the wait synchro */
   XBT_DEBUG("simcall_HANDLER_comm_wait, %p", synchro);
 
   /* Associate this simcall to the wait synchro */
   XBT_DEBUG("simcall_HANDLER_comm_wait, %p", synchro);
 
-  xbt_fifo_push(synchro->simcalls, simcall);
+  synchro->simcalls.push_back(simcall);
   simcall->issuer->waiting_synchro = synchro;
 
   if (MC_is_active() || MC_record_replay_is_active()) {
   simcall->issuer->waiting_synchro = synchro;
 
   if (MC_is_active() || MC_record_replay_is_active()) {
@@ -432,7 +434,7 @@ void simcall_HANDLER_comm_test(smx_simcall_t simcall, smx_synchro_t synchro)
     simcall_comm_test__set__result(simcall, comm->src_proc && comm->dst_proc);
     if (simcall_comm_test__get__result(simcall)){
       synchro->state = SIMIX_DONE;
     simcall_comm_test__set__result(simcall, comm->src_proc && comm->dst_proc);
     if (simcall_comm_test__get__result(simcall)){
       synchro->state = SIMIX_DONE;
-      xbt_fifo_push(synchro->simcalls, simcall);
+      synchro->simcalls.push_back(simcall);
       SIMIX_comm_finish(synchro);
     } else {
       SIMIX_simcall_answer(simcall);
       SIMIX_comm_finish(synchro);
     } else {
       SIMIX_simcall_answer(simcall);
@@ -442,7 +444,7 @@ void simcall_HANDLER_comm_test(smx_simcall_t simcall, smx_synchro_t synchro)
 
   simcall_comm_test__set__result(simcall, (synchro->state != SIMIX_WAITING && synchro->state != SIMIX_RUNNING));
   if (simcall_comm_test__get__result(simcall)) {
 
   simcall_comm_test__set__result(simcall, (synchro->state != SIMIX_WAITING && synchro->state != SIMIX_RUNNING));
   if (simcall_comm_test__get__result(simcall)) {
-    xbt_fifo_push(synchro->simcalls, simcall);
+    synchro->simcalls.push_back(simcall);
     SIMIX_comm_finish(synchro);
   } else {
     SIMIX_simcall_answer(simcall);
     SIMIX_comm_finish(synchro);
   } else {
     SIMIX_simcall_answer(simcall);
@@ -462,7 +464,7 @@ void simcall_HANDLER_comm_testany(smx_simcall_t simcall, xbt_dynar_t synchros)
     }else{
       synchro = xbt_dynar_get_as(synchros, idx, smx_synchro_t);
       simcall_comm_testany__set__result(simcall, idx);
     }else{
       synchro = xbt_dynar_get_as(synchros, idx, smx_synchro_t);
       simcall_comm_testany__set__result(simcall, idx);
-      xbt_fifo_push(synchro->simcalls, simcall);
+      synchro->simcalls.push_back(simcall);
       synchro->state = SIMIX_DONE;
       SIMIX_comm_finish(synchro);
     }
       synchro->state = SIMIX_DONE;
       SIMIX_comm_finish(synchro);
     }
@@ -472,7 +474,7 @@ void simcall_HANDLER_comm_testany(smx_simcall_t simcall, xbt_dynar_t synchros)
   xbt_dynar_foreach(simcall_comm_testany__get__comms(simcall), cursor,synchro) {
     if (synchro->state != SIMIX_WAITING && synchro->state != SIMIX_RUNNING) {
       simcall_comm_testany__set__result(simcall, cursor);
   xbt_dynar_foreach(simcall_comm_testany__get__comms(simcall), cursor,synchro) {
     if (synchro->state != SIMIX_WAITING && synchro->state != SIMIX_RUNNING) {
       simcall_comm_testany__set__result(simcall, cursor);
-      xbt_fifo_push(synchro->simcalls, simcall);
+      synchro->simcalls.push_back(simcall);
       SIMIX_comm_finish(synchro);
       return;
     }
       SIMIX_comm_finish(synchro);
       return;
     }
@@ -488,7 +490,7 @@ void simcall_HANDLER_comm_waitany(smx_simcall_t simcall, xbt_dynar_t synchros)
   if (MC_is_active() || MC_record_replay_is_active()){
     int idx = SIMCALL_GET_MC_VALUE(simcall);
     synchro = xbt_dynar_get_as(synchros, idx, smx_synchro_t);
   if (MC_is_active() || MC_record_replay_is_active()){
     int idx = SIMCALL_GET_MC_VALUE(simcall);
     synchro = xbt_dynar_get_as(synchros, idx, smx_synchro_t);
-    xbt_fifo_push(synchro->simcalls, simcall);
+    synchro->simcalls.push_back(simcall);
     simcall_comm_waitany__set__result(simcall, idx);
     synchro->state = SIMIX_DONE;
     SIMIX_comm_finish(synchro);
     simcall_comm_waitany__set__result(simcall, idx);
     synchro->state = SIMIX_DONE;
     SIMIX_comm_finish(synchro);
@@ -497,7 +499,7 @@ void simcall_HANDLER_comm_waitany(smx_simcall_t simcall, xbt_dynar_t synchros)
 
   xbt_dynar_foreach(synchros, cursor, synchro){
     /* associate this simcall to the the synchro */
 
   xbt_dynar_foreach(synchros, cursor, synchro){
     /* associate this simcall to the the synchro */
-    xbt_fifo_push(synchro->simcalls, simcall);
+    synchro->simcalls.push_back(simcall);
 
     /* see if the synchro is already finished */
     if (synchro->state != SIMIX_WAITING && synchro->state != SIMIX_RUNNING){
 
     /* see if the synchro is already finished */
     if (synchro->state != SIMIX_WAITING && synchro->state != SIMIX_RUNNING){
@@ -513,8 +515,12 @@ void SIMIX_waitany_remove_simcall_from_actions(smx_simcall_t simcall)
   unsigned int cursor = 0;
   xbt_dynar_t synchros = simcall_comm_waitany__get__comms(simcall);
 
   unsigned int cursor = 0;
   xbt_dynar_t synchros = simcall_comm_waitany__get__comms(simcall);
 
-  xbt_dynar_foreach(synchros, cursor, synchro)
-    xbt_fifo_remove(synchro->simcalls, simcall);
+  xbt_dynar_foreach(synchros, cursor, synchro) {
+    // Remove the first occurence of simcall:
+    auto i = boost::range::find(synchro->simcalls, simcall);
+    if (i !=  synchro->simcalls.end())
+      synchro->simcalls.erase(i);
+  }
 }
 
 /**
 }
 
 /**
@@ -568,9 +574,10 @@ void SIMIX_comm_finish(smx_synchro_t synchro)
 {
   simgrid::simix::Comm *comm = static_cast<simgrid::simix::Comm*>(synchro);
   unsigned int destroy_count = 0;
 {
   simgrid::simix::Comm *comm = static_cast<simgrid::simix::Comm*>(synchro);
   unsigned int destroy_count = 0;
-  smx_simcall_t simcall;
 
 
-  while ((simcall = (smx_simcall_t) xbt_fifo_shift(synchro->simcalls))) {
+  while (!synchro->simcalls.empty()) {
+    smx_simcall_t simcall = synchro->simcalls.front();
+    synchro->simcalls.pop_front();
 
     /* If a waitany simcall is waiting for this synchro to finish, then remove
        it from the other synchros in the waitany list. Afterwards, get the
 
     /* If a waitany simcall is waiting for this synchro to finish, then remove
        it from the other synchros in the waitany list. Afterwards, get the
index 35e783c..0fce5df 100644 (file)
@@ -4,6 +4,8 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
+#include <boost/range/algorithm.hpp>
+
 #include "src/surf/surf_interface.hpp"
 #include "smx_private.h"
 #include "xbt/sysdep.h"
 #include "src/surf/surf_interface.hpp"
 #include "smx_private.h"
 #include "xbt/sysdep.h"
@@ -465,7 +467,14 @@ void SIMIX_process_kill(smx_process_t process, smx_process_t issuer) {
     } else if (comm != nullptr) {
       xbt_fifo_remove(process->comms, process->waiting_synchro);
       comm->cancel();
     } else if (comm != nullptr) {
       xbt_fifo_remove(process->comms, process->waiting_synchro);
       comm->cancel();
-      xbt_fifo_remove(process->waiting_synchro->simcalls, &process->simcall);
+
+      // Remove first occurence of &process->simcall:
+      auto i = boost::range::find(
+        process->waiting_synchro->simcalls,
+        &process->simcall);
+      if (i != process->waiting_synchro->simcalls.end())
+        process->waiting_synchro->simcalls.remove(&process->simcall);
+
       comm->unref();
 
     } else if (sleep != nullptr) {
       comm->unref();
 
     } else if (sleep != nullptr) {
@@ -590,7 +599,7 @@ void simcall_HANDLER_process_suspend(smx_simcall_t simcall, smx_process_t proces
   if (process != simcall->issuer) {
     SIMIX_simcall_answer(simcall);
   } else {
   if (process != simcall->issuer) {
     SIMIX_simcall_answer(simcall);
   } else {
-    xbt_fifo_push(sync_suspend->simcalls, simcall);
+    sync_suspend->simcalls.push_back(simcall);
     process->waiting_synchro = sync_suspend;
     process->waiting_synchro->suspend();
   }
     process->waiting_synchro = sync_suspend;
     process->waiting_synchro->suspend();
   }
@@ -742,7 +751,7 @@ xbt_dict_t SIMIX_process_get_properties(smx_process_t process)
 void simcall_HANDLER_process_join(smx_simcall_t simcall, smx_process_t process, double timeout)
 {
   smx_synchro_t sync = SIMIX_process_join(simcall->issuer, process, timeout);
 void simcall_HANDLER_process_join(smx_simcall_t simcall, smx_process_t process, double timeout)
 {
   smx_synchro_t sync = SIMIX_process_join(simcall->issuer, process, timeout);
-  xbt_fifo_push(sync->simcalls, simcall);
+  sync->simcalls.push_back(simcall);
   simcall->issuer->waiting_synchro = sync;
 }
 
   simcall->issuer->waiting_synchro = sync;
 }
 
@@ -752,8 +761,9 @@ static int SIMIX_process_join_finish(smx_process_exit_status_t status, smx_synch
   if (sleep->surf_sleep) {
     sleep->surf_sleep->cancel();
 
   if (sleep->surf_sleep) {
     sleep->surf_sleep->cancel();
 
-    smx_simcall_t simcall;
-    while ((simcall = (smx_simcall_t) xbt_fifo_shift(sleep->simcalls))) {
+    while (!sleep->simcalls.empty()) {
+      smx_simcall_t simcall = sleep->simcalls.front();
+      sleep->simcalls.pop_front();
       simcall_process_sleep__set__result(simcall, SIMIX_DONE);
       simcall->issuer->waiting_synchro = NULL;
       if (simcall->issuer->suspended) {
       simcall_process_sleep__set__result(simcall, SIMIX_DONE);
       simcall->issuer->waiting_synchro = NULL;
       if (simcall->issuer->suspended) {
@@ -787,7 +797,7 @@ void simcall_HANDLER_process_sleep(smx_simcall_t simcall, double duration)
     return;
   }
   smx_synchro_t sync = SIMIX_process_sleep(simcall->issuer, duration);
     return;
   }
   smx_synchro_t sync = SIMIX_process_sleep(simcall->issuer, duration);
-  xbt_fifo_push(sync->simcalls, simcall);
+  sync->simcalls.push_back(simcall);
   simcall->issuer->waiting_synchro = sync;
 }
 
   simcall->issuer->waiting_synchro = sync;
 }
 
index 67e4eaa..b0eba6f 100644 (file)
@@ -66,7 +66,8 @@ void SIMIX_synchro_stop_waiting(smx_process_t process, smx_simcall_t simcall)
 void SIMIX_synchro_finish(smx_synchro_t synchro)
 {
   XBT_IN("(%p)",synchro);
 void SIMIX_synchro_finish(smx_synchro_t synchro)
 {
   XBT_IN("(%p)",synchro);
-  smx_simcall_t simcall = (smx_simcall_t) xbt_fifo_shift(synchro->simcalls);
+  smx_simcall_t simcall = synchro->simcalls.front();
+  synchro->simcalls.pop_front();
 
   switch (synchro->state) {
 
 
   switch (synchro->state) {
 
@@ -128,7 +129,7 @@ void simcall_HANDLER_mutex_lock(smx_simcall_t simcall, smx_mutex_t mutex)
     /* FIXME: check if the host is active ? */
     /* Somebody using the mutex, use a synchronization to get host failures */
     synchro = SIMIX_synchro_wait(process->host, -1);
     /* FIXME: check if the host is active ? */
     /* Somebody using the mutex, use a synchronization to get host failures */
     synchro = SIMIX_synchro_wait(process->host, -1);
-    xbt_fifo_push(synchro->simcalls, simcall);
+    synchro->simcalls.push_back(simcall);
     simcall->issuer->waiting_synchro = synchro;
     xbt_swag_insert(simcall->issuer, mutex->sleeping);   
   } else {
     simcall->issuer->waiting_synchro = synchro;
     xbt_swag_insert(simcall->issuer, mutex->sleeping);   
   } else {
@@ -282,7 +283,7 @@ static void _SIMIX_cond_wait(smx_cond_t cond, smx_mutex_t mutex, double timeout,
   }
 
   synchro = SIMIX_synchro_wait(issuer->host, timeout);
   }
 
   synchro = SIMIX_synchro_wait(issuer->host, timeout);
-  xbt_fifo_unshift(synchro->simcalls, simcall);
+  synchro->simcalls.push_front(simcall);
   issuer->waiting_synchro = synchro;
   xbt_swag_insert(simcall->issuer, cond->sleeping);   
   XBT_OUT();
   issuer->waiting_synchro = synchro;
   xbt_swag_insert(simcall->issuer, cond->sleeping);   
   XBT_OUT();
@@ -446,7 +447,7 @@ static void _SIMIX_sem_wait(smx_sem_t sem, double timeout, smx_process_t issuer,
   XBT_DEBUG("Wait semaphore %p (timeout:%f)", sem, timeout);
   if (sem->value <= 0) {
     synchro = SIMIX_synchro_wait(issuer->host, timeout);
   XBT_DEBUG("Wait semaphore %p (timeout:%f)", sem, timeout);
   if (sem->value <= 0) {
     synchro = SIMIX_synchro_wait(issuer->host, timeout);
-    xbt_fifo_unshift(synchro->simcalls, simcall);
+    synchro->simcalls.push_front(simcall);
     issuer->waiting_synchro = synchro;
     xbt_swag_insert(issuer, sem->sleeping);
   } else {
     issuer->waiting_synchro = synchro;
     xbt_swag_insert(issuer, sem->sleeping);
   } else {