Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Rename kernel::activity::Synchro into kernel::activity::ActivityImpl
authorMartin Quinson <martin.quinson@loria.fr>
Sun, 7 Aug 2016 16:52:22 +0000 (18:52 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Sun, 7 Aug 2016 16:52:22 +0000 (18:52 +0200)
17 files changed:
include/simgrid/forward.h
include/simgrid/s4u/Activity.hpp
include/simgrid/s4u/comm.hpp
src/kernel/activity/ActivityImpl.cpp [new file with mode: 0644]
src/kernel/activity/ActivityImpl.hpp [moved from src/kernel/activity/Synchro.h with 59% similarity]
src/kernel/activity/Synchro.cpp [deleted file]
src/kernel/activity/SynchroComm.hpp
src/kernel/activity/SynchroExec.hpp
src/kernel/activity/SynchroIo.hpp
src/kernel/activity/SynchroRaw.hpp
src/kernel/activity/SynchroSleep.hpp
src/mc/mc_base.cpp
src/msg/msg_gos.cpp
src/simix/ActorImpl.cpp
src/simix/smx_network.cpp
src/smpi/smpi_base.cpp
tools/cmake/DefinePackages.cmake

index 63f3269..66b4b3e 100644 (file)
@@ -19,7 +19,7 @@ namespace simgrid {
   }
   namespace kernel {
      namespace activity {
-       class Synchro;
+       class ActivityImpl;
      }
      namespace routing {
        class NetCard;
@@ -39,7 +39,7 @@ namespace simgrid {
 typedef simgrid::s4u::As simgrid_As;
 typedef simgrid::s4u::Host simgrid_Host;
 typedef boost::intrusive_ptr<simgrid::s4u::Mailbox> sg_mbox_t;
-typedef simgrid::kernel::activity::Synchro simgrid_Synchro;
+typedef simgrid::kernel::activity::ActivityImpl kernel_Activity;
 typedef simgrid::kernel::routing::NetCard routing_NetCard;
 typedef simgrid::surf::Cpu surf_Cpu;
 typedef simgrid::surf::Link Link;
@@ -51,7 +51,7 @@ typedef simgrid::trace_mgr::trace tmgr_Trace;
 typedef struct simgrid_As   simgrid_As;
 typedef struct simgrid_Host simgrid_Host;
 typedef struct simgrid_Mailbox *sg_mbox_t;
-typedef struct simgrid_Synchro simgrid_Synchro;
+typedef struct kernel_Activity kernel_Activity;
 typedef struct surf_Cpu surf_Cpu;
 typedef struct routing_NetCard routing_NetCard;
 typedef struct surf_Resource surf_Resource;
@@ -62,7 +62,7 @@ typedef struct Trace tmgr_Trace;
 typedef simgrid_As *AS_t;
 typedef simgrid_Host* sg_host_t;
 
-typedef simgrid_Synchro *smx_synchro_t;
+typedef kernel_Activity *smx_synchro_t;
 
 typedef surf_Cpu *surf_cpu_t;
 typedef routing_NetCard *sg_netcard_t;
index ac26e09..1cdd79e 100644 (file)
@@ -66,7 +66,7 @@ public:
   void *getUserData() { return userData_; }
 
 private:
-  simgrid::kernel::activity::Synchro *pimpl_ = nullptr;
+  simgrid::kernel::activity::ActivityImpl *pimpl_ = nullptr;
   e_s4u_activity_state_t state_ = inited;
   double remains_ = 0;
   void *userData_ = nullptr;
index ecb1e09..9c853dc 100644 (file)
@@ -34,13 +34,13 @@ public:
   I wait_any(I first, I last)
   {
     // Map to dynar<Synchro*>:
-    xbt_dynar_t comms = xbt_dynar_new(sizeof(simgrid::kernel::activity::Synchro*), NULL);
+    xbt_dynar_t comms = xbt_dynar_new(sizeof(simgrid::kernel::activity::ActivityImpl*), NULL);
     for(I iter = first; iter != last; iter++) {
       Comm& comm = **iter;
       if (comm.state_ == inited)
         comm.start();
       xbt_assert(comm.state_ == started);
-      xbt_dynar_push_as(comms, simgrid::kernel::activity::Synchro*, comm.pimpl_);
+      xbt_dynar_push_as(comms, simgrid::kernel::activity::ActivityImpl*, comm.pimpl_);
     }
     // Call the underlying simcall:
     int idx = simcall_comm_waitany(comms, -1);
@@ -58,13 +58,13 @@ public:
   I wait_any_for(I first, I last, double timeout)
   {
     // Map to dynar<Synchro*>:
-    xbt_dynar_t comms = xbt_dynar_new(sizeof(simgrid::kernel::activity::Synchro*), NULL);
+    xbt_dynar_t comms = xbt_dynar_new(sizeof(simgrid::kernel::activity::ActivityImpl*), NULL);
     for(I iter = first; iter != last; iter++) {
       Comm& comm = **iter;
       if (comm.state_ == inited)
         comm.start();
       xbt_assert(comm.state_ == started);
-      xbt_dynar_push_as(comms, simgrid::kernel::activity::Synchro*, comm.pimpl_);
+      xbt_dynar_push_as(comms, simgrid::kernel::activity::ActivityImpl*, comm.pimpl_);
     }
     // Call the underlying simcall:
     int idx = simcall_comm_waitany(comms, timeout);
diff --git a/src/kernel/activity/ActivityImpl.cpp b/src/kernel/activity/ActivityImpl.cpp
new file mode 100644 (file)
index 0000000..986e7c5
--- /dev/null
@@ -0,0 +1,30 @@
+/* Copyright (c) 2007-2016. The SimGrid Team. All rights reserved.          */
+
+/* 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 "src/kernel/activity/ActivityImpl.hpp"
+
+simgrid::kernel::activity::ActivityImpl::ActivityImpl()
+{
+}
+
+simgrid::kernel::activity::ActivityImpl::~ActivityImpl()
+{
+}
+
+void simgrid::kernel::activity::ActivityImpl::ref()
+{
+  refcount++;
+}
+
+void simgrid::kernel::activity::ActivityImpl::unref()
+{
+  xbt_assert(refcount > 0,
+      "This activity has a negative refcount! You can only call test() or wait() once per activity.");
+
+  refcount--;
+  if (refcount>0)
+    return;
+  delete this;
+}
similarity index 59%
rename from src/kernel/activity/Synchro.h
rename to src/kernel/activity/ActivityImpl.hpp
index 2146efb..94b8590 100644 (file)
@@ -3,8 +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. */
 
-#ifndef _SIMIX_SYNCHRO_HPP
-#define _SIMIX_SYNCHRO_HPP
+#ifndef SIMGRID_KERNEL_ACTIVITY_ACTIVITYIMPL_HPP
+#define SIMGRID_KERNEL_ACTIVITY_ACTIVITYIMPL_HPP
 
 #include <string>
 #include <list>
 #include <xbt/base.h>
 #include "simgrid/forward.h"
 
-#ifdef __cplusplus
-
 #include <simgrid/simix.hpp>
 
 namespace simgrid {
 namespace kernel {
 namespace activity {
 
-  XBT_PUBLIC_CLASS Synchro {
+  XBT_PUBLIC_CLASS ActivityImpl {
   public:
-    Synchro();
-    virtual ~Synchro();
-    e_smx_state_t state = SIMIX_WAITING; /* State of the synchro */
-    std::string name;                  /* synchro name if any */
-    std::list<smx_simcall_t> simcalls; /* List of simcalls waiting for this synchro */
+    ActivityImpl();
+    virtual ~ActivityImpl();
+    e_smx_state_t state = SIMIX_WAITING; /* State of the activity */
+    std::string name;                    /* Activity name if any */
+    std::list<smx_simcall_t> simcalls;   /* List of simcalls waiting for this activity */
 
     virtual void suspend()=0;
     virtual void resume()=0;
@@ -38,9 +36,5 @@ namespace activity {
     int refcount = 1;
   };
 }}} // namespace simgrid::kernel::activity
-#else /* not C++ */
-
-
-#endif
 
-#endif
+#endif /* SIMGRID_KERNEL_ACTIVITY_ACTIVITYIMPL_HPP */
diff --git a/src/kernel/activity/Synchro.cpp b/src/kernel/activity/Synchro.cpp
deleted file mode 100644 (file)
index cbe5cd3..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (c) 2007-2016. The SimGrid Team. All rights reserved.          */
-
-/* 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 "src/kernel/activity/Synchro.h"
-
-simgrid::kernel::activity::Synchro::Synchro()
-{
-}
-
-simgrid::kernel::activity::Synchro::~Synchro()
-{
-}
-
-void simgrid::kernel::activity::Synchro::ref()
-{
-  refcount++;
-}
-
-void simgrid::kernel::activity::Synchro::unref()
-{
-  xbt_assert(refcount > 0,
-      "This synchro has a negative refcount! You can only call test() or wait() once per synchronization.");
-
-  refcount--;
-  if (refcount>0)
-    return;
-  delete this;
-}
index 608f0fa..60b0b30 100644 (file)
@@ -7,7 +7,7 @@
 #define _SIMIX_SYNCHRO_COMM_HPP
 
 #include "surf/surf.h"
-#include "src/kernel/activity/Synchro.h"
+#include "src/kernel/activity/ActivityImpl.hpp"
 
 typedef enum {
   SIMIX_COMM_SEND,
@@ -20,7 +20,7 @@ namespace simgrid {
 namespace kernel {
 namespace activity {
 
-  XBT_PUBLIC_CLASS Comm : public Synchro {
+  XBT_PUBLIC_CLASS Comm : public ActivityImpl {
     ~Comm() override;
   public:
     explicit Comm(e_smx_comm_type_t type);
index facfa53..d669494 100644 (file)
@@ -7,13 +7,13 @@
 #define _SIMIX_SYNCHRO_EXEC_HPP
 
 #include "surf/surf.h"
-#include "src/kernel/activity/Synchro.h"
+#include "src/kernel/activity/ActivityImpl.hpp"
 
 namespace simgrid {
 namespace kernel {
 namespace activity {
 
-  XBT_PUBLIC_CLASS Exec : public Synchro {
+  XBT_PUBLIC_CLASS Exec : public ActivityImpl {
     ~Exec() override;
   public:
     Exec(const char*name, sg_host_t host);
index a5202ee..59f307f 100644 (file)
@@ -7,13 +7,13 @@
 #define _SIMIX_SYNCHRO_IO_HPP
 
 #include "surf/surf.h"
-#include "src/kernel/activity/Synchro.h"
+#include "src/kernel/activity/ActivityImpl.hpp"
 
 namespace simgrid {
 namespace kernel {
 namespace activity {
 
-  XBT_PUBLIC_CLASS Io : public Synchro {
+  XBT_PUBLIC_CLASS Io : public ActivityImpl {
   public:
     void suspend() override;
     void resume() override;
index cac619c..035d295 100644 (file)
@@ -7,14 +7,14 @@
 #define _SIMIX_SYNCHRO_RAW_HPP
 
 #include "surf/surf.h"
-#include "src/kernel/activity/Synchro.h"
+#include "src/kernel/activity/ActivityImpl.hpp"
 
 namespace simgrid {
 namespace kernel {
 namespace activity {
 
   /** Used to implement mutexes, semaphores and conditions */
-  XBT_PUBLIC_CLASS Raw : public Synchro {
+  XBT_PUBLIC_CLASS Raw : public ActivityImpl {
   public:
     ~Raw() override;
     void suspend() override;
index d247833..0edef63 100644 (file)
@@ -7,13 +7,13 @@
 #define _SIMIX_SYNCHRO_SLEEP_HPP
 
 #include "surf/surf.h"
-#include "src/kernel/activity/Synchro.h"
+#include "src/kernel/activity/ActivityImpl.hpp"
 
 namespace simgrid {
 namespace kernel {
 namespace activity {
 
-  XBT_PUBLIC_CLASS Sleep : public Synchro {
+  XBT_PUBLIC_CLASS Sleep : public ActivityImpl {
   public:
     void suspend() override;
     void resume() override;
index aa6f7af..4c3667c 100644 (file)
@@ -20,7 +20,7 @@
 #include "mc/mc.h"
 #include "src/mc/mc_protocol.h"
 
-#include "src/kernel/activity/Synchro.h"
+#include "src/kernel/activity/ActivityImpl.hpp"
 #include "src/kernel/activity/SynchroIo.hpp"
 #include "src/kernel/activity/SynchroComm.hpp"
 #include "src/kernel/activity/SynchroRaw.hpp"
index b4cffe9..86e1160 100644 (file)
@@ -528,7 +528,7 @@ int MSG_comm_testany(xbt_dynar_t comms)
   int finished_index = -1;
 
   /* Create the equivalent array with SIMIX objects: */
-  std::vector<simgrid::kernel::activity::Synchro*> s_comms;
+  std::vector<simgrid::kernel::activity::ActivityImpl*> s_comms;
   s_comms.reserve(xbt_dynar_length(comms));
   msg_comm_t comm;
   unsigned int cursor;
index 0295c43..ce44678 100644 (file)
@@ -780,7 +780,7 @@ static int SIMIX_process_join_finish(smx_process_exit_status_t status, smx_synch
 smx_synchro_t SIMIX_process_join(smx_process_t issuer, smx_process_t process, double timeout)
 {
   smx_synchro_t res = SIMIX_process_sleep(issuer, timeout);
-  static_cast<simgrid::kernel::activity::Synchro*>(res)->ref();
+  static_cast<simgrid::kernel::activity::ActivityImpl*>(res)->ref();
   SIMIX_process_on_exit(process, (int_f_pvoid_pvoid_t)SIMIX_process_join_finish, res);
   return res;
 }
index ffc2f72..351fe9d 100644 (file)
@@ -445,7 +445,7 @@ void simcall_HANDLER_comm_test(smx_simcall_t simcall, smx_synchro_t synchro)
 }
 
 void simcall_HANDLER_comm_testany(
-  smx_simcall_t simcall, simgrid::kernel::activity::Synchro* comms[], size_t count)
+  smx_simcall_t simcall, simgrid::kernel::activity::ActivityImpl* comms[], size_t count)
 {
   // The default result is -1 -- this means, "nothing is ready".
   // It can be changed below, but only if something matches.
@@ -456,7 +456,7 @@ void simcall_HANDLER_comm_testany(
     if(idx == -1){
       SIMIX_simcall_answer(simcall);
     }else{
-      simgrid::kernel::activity::Synchro* synchro = comms[idx];
+      simgrid::kernel::activity::ActivityImpl* synchro = comms[idx];
       simcall_comm_testany__set__result(simcall, idx);
       synchro->simcalls.push_back(simcall);
       synchro->state = SIMIX_DONE;
@@ -466,7 +466,7 @@ void simcall_HANDLER_comm_testany(
   }
 
   for (std::size_t i = 0; i != count; ++i) {
-    simgrid::kernel::activity::Synchro* synchro = comms[i];
+    simgrid::kernel::activity::ActivityImpl* synchro = comms[i];
     if (synchro->state != SIMIX_WAITING && synchro->state != SIMIX_RUNNING) {
       simcall_comm_testany__set__result(simcall, i);
       synchro->simcalls.push_back(simcall);
index b2f5765..6019e6e 100644 (file)
@@ -773,7 +773,7 @@ int smpi_mpi_test(MPI_Request * request, MPI_Status * status) {
 
 int smpi_mpi_testany(int count, MPI_Request requests[], int *index, MPI_Status * status)
 {
-  std::vector<simgrid::kernel::activity::Synchro*> comms;
+  std::vector<simgrid::kernel::activity::ActivityImpl*> comms;
   comms.reserve(count);
 
   int i;
index c80f95e..61af940 100644 (file)
@@ -31,7 +31,7 @@ set(EXTRA_DIST
   src/simix/smx_private.h
   src/simix/ActorImpl.hpp
   src/simix/smx_synchro_private.h
-  src/kernel/activity/Synchro.h
+  src/kernel/activity/ActivityImpl.hpp
   src/kernel/activity/SynchroComm.hpp
   src/kernel/activity/SynchroExec.hpp
   src/kernel/activity/SynchroIo.hpp
@@ -353,7 +353,7 @@ set(SIMIX_SRC
   src/simix/smx_synchro.cpp
   src/simix/smx_vm.cpp
   src/simix/popping.cpp
-  src/kernel/activity/Synchro.cpp
+  src/kernel/activity/ActivityImpl.cpp
   src/kernel/activity/SynchroComm.cpp
   src/kernel/activity/SynchroExec.cpp
   src/kernel/activity/SynchroSleep.cpp