Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix BoostContext #include
[simgrid.git] / src / simix / SynchroComm.cpp
index 69eca5d..74f8492 100644 (file)
@@ -9,7 +9,17 @@
 #include "simgrid/modelchecker.h"
 #include "src/mc/mc_replay.h"
 
+XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_network);
 
+simgrid::simix::Comm::Comm(e_smx_comm_type_t _type) {
+  state = SIMIX_WAITING;
+  this->type = _type;
+  refcount = 1;
+  src_data=NULL;
+  dst_data=NULL;
+
+  XBT_DEBUG("Create communicate synchro %p", this);
+}
 void simgrid::simix::Comm::suspend() {
   /* FIXME: shall we suspend also the timeout synchro? */
   if (surf_comm)
@@ -39,3 +49,22 @@ void simgrid::simix::Comm::cancel() {
     surf_comm->cancel();
   }
 }
+
+/**  @brief get the amount remaining from the communication */
+double simgrid::simix::Comm::remains() {
+  switch (state) {
+
+  case SIMIX_RUNNING:
+    return surf_comm->getRemains();
+    break;
+
+  case SIMIX_WAITING:
+  case SIMIX_READY:
+    return 0; /*FIXME: check what should be returned */
+    break;
+
+  default:
+    return 0; /*FIXME: is this correct? */
+    break;
+  }
+}