Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Rename smx_process to ActorImpl
authorMartin Quinson <martin.quinson@loria.fr>
Mon, 1 Aug 2016 09:28:40 +0000 (11:28 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Mon, 1 Aug 2016 09:28:40 +0000 (11:28 +0200)
19 files changed:
include/simgrid/s4u/Actor.hpp
include/simgrid/simix.h
src/kernel/activity/SynchroSleep.cpp
src/mc/Process.hpp
src/mc/mc_global.cpp
src/mc/mc_record.cpp
src/msg/instr_msg_process.cpp
src/msg/msg_process.cpp
src/s4u/s4u_actor.cpp
src/s4u/s4u_host.cpp
src/s4u/s4u_mailbox.cpp
src/simix/ActorImpl.cpp [moved from src/simix/smx_process.cpp with 99% similarity]
src/simix/ActorImpl.hpp [moved from src/simix/smx_process_private.h with 88% similarity]
src/simix/smx_global.cpp
src/simix/smx_host.cpp
src/simix/smx_network_private.h
src/simix/smx_private.h
src/simix/smx_synchro.cpp
tools/cmake/DefinePackages.cmake

index 7f3f4a6..5fbd5f8 100644 (file)
@@ -132,7 +132,7 @@ namespace s4u {
 /** @brief Simulation Agent (see \ref s4u_actor)*/
 XBT_PUBLIC_CLASS Actor {
   friend Mailbox;
-  friend simgrid::simix::Process;
+  friend simgrid::simix::ActorImpl;
   smx_process_t pimpl_ = nullptr;
 
   /** Wrap a (possibly non-copyable) single-use task into a `std::function` */
index 4d766f2..6b03ad7 100644 (file)
@@ -28,7 +28,7 @@ namespace simix {
       data</em>, executing in a <em>location</em>.
       \see m_process_management
     @{ */
-  class Process;
+  class ActorImpl;
   class Context;
   class ContextFactory;
   class Mutex;
@@ -37,7 +37,7 @@ namespace simix {
 }
 
 typedef simgrid::simix::Context *smx_context_t;
-typedef simgrid::simix::Process *smx_process_t;
+typedef simgrid::simix::ActorImpl *smx_process_t;
 typedef simgrid::simix::Mutex   *smx_mutex_t;
 typedef simgrid::simix::Mailbox *smx_mailbox_t;
 
index e8f10df..5335d50 100644 (file)
@@ -8,9 +8,10 @@
 #include <simgrid/s4u/host.hpp>
 
 #include "src/kernel/activity/SynchroSleep.hpp"
+
 #include "src/surf/surf_interface.hpp"
+#include "src/simix/ActorImpl.hpp"
 #include "src/simix/popping_private.h"
-#include "src/simix/smx_process_private.h"
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_process);
 
index 23d2620..9778702 100644 (file)
@@ -45,8 +45,8 @@ namespace mc {
 class SimixProcessInformation {
 public:
   /** MCed address of the process */
-  RemotePtr<simgrid::simix::Process> address = nullptr;
-  Remote<simgrid::simix::Process> copy;
+  RemotePtr<simgrid::simix::ActorImpl> address = nullptr;
+  Remote<simgrid::simix::ActorImpl> copy;
 
   /** Hostname (owned by `mc_modelchecker->hostnames`) */
   const char* hostname = nullptr;
@@ -224,7 +224,7 @@ public:
 
   /** Get a local description of a remote SIMIX process */
   simgrid::mc::SimixProcessInformation* resolveProcessInfo(
-    simgrid::mc::RemotePtr<simgrid::simix::Process> process)
+    simgrid::mc::RemotePtr<simgrid::simix::ActorImpl> process)
   {
     xbt_assert(mc_model_checker != nullptr);
     if (!process)
@@ -240,7 +240,7 @@ public:
   }
 
   /** Get a local copy of the SIMIX process structure */
-  simgrid::simix::Process* resolveProcess(simgrid::mc::RemotePtr<simgrid::simix::Process> process)
+  simgrid::simix::ActorImpl* resolveProcess(simgrid::mc::RemotePtr<simgrid::simix::ActorImpl> process)
   {
     simgrid::mc::SimixProcessInformation* process_info =
       this->resolveProcessInfo(process);
index d6d0b51..aaae1d4 100644 (file)
@@ -27,7 +27,7 @@
 #include <sys/time.h>
 #endif
 
-#include "src/simix/smx_process_private.h"
+#include "src/simix/ActorImpl.hpp"
 
 #if HAVE_MC
 #include <libunwind.h>
index f5d3f2b..4a8fb95 100644 (file)
 
 #include "simgrid/simix.h"
 
+#include "src/simix/ActorImpl.hpp"
 #include "src/simix/smx_private.h"
-#include "src/simix/smx_process_private.h"
-
 #include "src/mc/mc_replay.h"
 #include "src/mc/mc_record.h"
+
 #include "src/mc/mc_base.h"
 #include "src/mc/Transition.hpp"
 
index 6767f99..bcdb775 100644 (file)
@@ -4,8 +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. */
 
+#include "src/simix/ActorImpl.hpp"
 #include "msg_private.h"
-#include "src/simix/smx_process_private.h"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_msg_process, instr, "MSG process");
 
index 0a2d2a9..cf77537 100644 (file)
@@ -10,7 +10,7 @@
 #include "xbt/sysdep.h"
 #include "xbt/log.h"
 #include "xbt/functional.hpp"
-#include "src/simix/smx_process_private.h"
+#include "src/simix/ActorImpl.hpp"
 #include "src/simix/smx_private.h"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_process, msg, "Logging specific to MSG (process)");
index 68f66fd..6db4d97 100644 (file)
@@ -26,7 +26,7 @@ ActorPtr Actor::self()
   if (self_context == nullptr)
     return simgrid::s4u::ActorPtr();
 
-  return simgrid::s4u::ActorPtr(&self_context->process()->actor());
+  return simgrid::s4u::ActorPtr(&self_context->process()->getIface());
 }
 
 
@@ -37,7 +37,7 @@ ActorPtr Actor::createActor(const char* name, s4u::Host *host, double killTime,
   smx_process_t process = simcall_process_create(
     name, std::move(code), nullptr, host->name().c_str(),
     killTime, nullptr, 0);
-  return Ptr(&process->actor());
+  return Ptr(&process->getIface());
 }
 
 ActorPtr Actor::createActor(const char* name, s4u::Host *host, double killTime,
@@ -48,7 +48,7 @@ ActorPtr Actor::createActor(const char* name, s4u::Host *host, double killTime,
   smx_process_t process = simcall_process_create(
     name, std::move(code), nullptr, host->name().c_str(),
     killTime, nullptr, 0);
-  return ActorPtr(&process->actor());
+  return ActorPtr(&process->getIface());
 }
 
 // ***** Actor methods *****
@@ -106,7 +106,7 @@ ActorPtr Actor::forPid(int pid)
 {
   smx_process_t process = SIMIX_process_from_PID(pid);
   if (process != nullptr)
-    return ActorPtr(&process->actor());
+    return ActorPtr(&process->getIface());
   else
     return nullptr;
 }
index f17f894..e4d3d6c 100644 (file)
@@ -14,7 +14,7 @@
 #include "src/surf/HostImpl.hpp"
 #include "xbt/log.h"
 #include "src/msg/msg_private.h"
-#include "src/simix/smx_process_private.h"
+#include "src/simix/ActorImpl.hpp"
 #include "src/simix/smx_private.h"
 #include "src/surf/cpu_interface.hpp"
 #include "simgrid/s4u/host.hpp"
index 20a3bcf..11dbb99 100644 (file)
@@ -6,9 +6,8 @@
 
 #include "xbt/log.h"
 #include "src/msg/msg_private.h"
+#include "src/simix/ActorImpl.hpp"
 #include "src/simix/smx_network_private.h"
-#include "src/simix/smx_process_private.h"
-
 #include "simgrid/s4u/mailbox.hpp"
 
 XBT_LOG_EXTERNAL_CATEGORY(s4u);
@@ -53,7 +52,7 @@ void Mailbox::setReceiver(ActorPtr actor) {
 ActorPtr Mailbox::receiver() {
   if(pimpl_->permanent_receiver == nullptr)
     return ActorPtr();
-  return ActorPtr(&pimpl_->permanent_receiver->actor());
+  return ActorPtr(&pimpl_->permanent_receiver->getIface());
 }
 
 }
@@ -68,5 +67,5 @@ int sg_mbox_is_empty(sg_mbox_t mbox) {
   return mbox->empty();
 }
 void sg_mbox_setReceiver(sg_mbox_t mbox, smx_process_t process) {
-  mbox->setReceiver(&process->actor());
+  mbox->setReceiver(&process->getIface());
 }
similarity index 99%
rename from src/simix/smx_process.cpp
rename to src/simix/ActorImpl.cpp
index 9d23a07..5a45462 100644 (file)
@@ -160,7 +160,7 @@ void SIMIX_process_empty_trash()
 namespace simgrid {
 namespace simix {
 
-Process::~Process()
+ActorImpl::~ActorImpl()
 {
   delete this->context;
   if (this->properties)
@@ -175,7 +175,7 @@ void create_maestro(std::function<void()> code)
 {
   smx_process_t maestro = nullptr;
   /* Create maestro process and intilialize it */
-  maestro = new simgrid::simix::Process();
+  maestro = new simgrid::simix::ActorImpl();
   maestro->pid = simix_process_maxpid++;
   maestro->ppid = -1;
   maestro->name = "";
@@ -260,7 +260,7 @@ smx_process_t SIMIX_process_create(
     return nullptr;
   }
   else {
-    process = new simgrid::simix::Process();
+    process = new simgrid::simix::ActorImpl();
 
     xbt_assert(code && host != nullptr, "Invalid parameters");
     /* Process data */
@@ -345,7 +345,7 @@ smx_process_t SIMIX_process_attach(
     return nullptr;
   }
 
-  smx_process_t process = new simgrid::simix::Process();
+  smx_process_t process = new simgrid::simix::ActorImpl();
   /* Process data */
   process->pid = simix_process_maxpid++;
   process->name = std::string(name);
similarity index 88%
rename from src/simix/smx_process_private.h
rename to src/simix/ActorImpl.hpp
index 2fbbc14..53cb95a 100644 (file)
@@ -1,11 +1,10 @@
-/* Copyright (c) 2007-2010, 2012-2015. The SimGrid Team.
- * All rights reserved.                                                     */
+/* 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. */
 
-#ifndef _SIMIX_PROCESS_PRIVATE_H
-#define _SIMIX_PROCESS_PRIVATE_H
+#ifndef _SIMIX_ACTORIMPL_H
+#define _SIMIX_ACTORIMPL_H
 
 #include <atomic>
 #include <functional>
@@ -39,9 +38,9 @@ public:
   bool auto_restart     = false;
 };
 
-class Process {
+class ActorImpl {
 public:
-  Process() : actor_(this) {}
+  ActorImpl() : piface_(this) {}
 
   // TODO, replace with boost intrusive container hooks
   s_xbt_swag_hookup_t process_hookup   = { nullptr, nullptr }; /* simix_global->process_list */
@@ -72,16 +71,16 @@ public:
 
   std::function<void()> code;
   smx_timer_t kill_timer = nullptr;
-  int segment_index      = 0;    /*Reference to an SMPI process' data segment. Default value is -1 if not in SMPI context*/
+  int segment_index      = 0; /* Reference to an SMPI process' data segment. Default value is -1 if not in SMPI context*/
 
-  friend void intrusive_ptr_add_ref(Process* process)
+  friend void intrusive_ptr_add_ref(ActorImpl* process)
   {
     // Atomic operation! Do not split in two instructions!
     auto previous = (process->refcount_)++;
     xbt_assert(previous != 0);
     (void) previous;
   }
-  friend void intrusive_ptr_release(Process* process)
+  friend void intrusive_ptr_release(ActorImpl* process)
   {
     // Atomic operation! Do not split in two instructions!
     auto count = --(process->refcount_);
@@ -89,13 +88,13 @@ public:
       delete process;
   }
 
-  ~Process();
+  ~ActorImpl();
 
-  simgrid::s4u::Actor& actor() { return actor_; }
+  simgrid::s4u::Actor& getIface() { return piface_; }
 
 private:
   std::atomic_int_fast32_t refcount_ { 1 };
-  simgrid::s4u::Actor actor_;
+  simgrid::s4u::Actor piface_;
 };
 
 }
@@ -103,7 +102,7 @@ private:
 
 typedef simgrid::simix::ProcessArg *smx_process_arg_t;
 
-typedef simgrid::simix::Process* smx_process_t;
+typedef simgrid::simix::ActorImpl* smx_process_t;
 
 SG_BEGIN_DECL()
 
index 1ecce23..c2229a7 100644 (file)
@@ -201,7 +201,7 @@ void SIMIX_global_init(int *argc, char **argv)
   if (!simix_global) {
     simix_global = std::unique_ptr<simgrid::simix::Global>(new simgrid::simix::Global());
 
-    simgrid::simix::Process proc;
+    simgrid::simix::ActorImpl proc;
     simix_global->process_to_run = xbt_dynar_new(sizeof(smx_process_t), nullptr);
     simix_global->process_that_ran = xbt_dynar_new(sizeof(smx_process_t), nullptr);
     simix_global->process_list = xbt_swag_new(xbt_swag_offset(proc, process_hookup));
index 43365f2..5d534ba 100644 (file)
@@ -23,7 +23,7 @@ void SIMIX_host_create(sg_host_t host) // FIXME: braindead prototype. Take sg_ho
   smx_host_priv_t smx_host = xbt_new0(s_smx_host_priv_t, 1);
 
   /* Host structure */
-  simgrid::simix::Process proc;
+  simgrid::simix::ActorImpl proc;
   smx_host->process_list = xbt_swag_new(xbt_swag_offset(proc, host_proc_hookup));
 
   /* Update global variables */
index fb1e1cf..630fa4e 100644 (file)
@@ -18,7 +18,7 @@
 
 #include "simgrid/simix.h"
 #include "popping_private.h"
-#include "src/simix/smx_process_private.h"
+#include "src/simix/ActorImpl.hpp"
 
 namespace simgrid {
 namespace simix {
@@ -35,7 +35,7 @@ public:
   simgrid::s4u::Mailbox piface_; // Our interface
   char* name;
   std::deque<smx_synchro_t> comm_queue;
-  boost::intrusive_ptr<simgrid::simix::Process> permanent_receiver; //process which the mailbox is attached to
+  boost::intrusive_ptr<simgrid::simix::ActorImpl> permanent_receiver; //process which the mailbox is attached to
   std::deque<smx_synchro_t> done_comm_queue;//messages already received in the permanent receive mode
 };
 
index 108b770..fcb5469 100644 (file)
@@ -27,7 +27,6 @@
 #include "xbt/function_types.h"
 #include "src/xbt/ex_interface.h"
 #include "src/instr/instr_private.h"
-#include "smx_process_private.h"
 #include "smx_host_private.h"
 #include "smx_io_private.h"
 #include "smx_network_private.h"
@@ -35,6 +34,7 @@
 #include "smx_synchro_private.h"
 
 #include <signal.h>
+#include "src/simix/ActorImpl.hpp"
 
 #ifdef __cplusplus
 
index 93120cb..81017c1 100644 (file)
@@ -102,7 +102,7 @@ Mutex::Mutex() : mutex_(this)
 {
   XBT_IN("(%p)", this);
   // Useful to initialize sleeping swag:
-  simgrid::simix::Process p;
+  simgrid::simix::ActorImpl p;
   this->sleeping = xbt_swag_new(xbt_swag_offset(p, synchro_hookup));
   XBT_OUT();
 }
@@ -237,7 +237,7 @@ void simcall_HANDLER_mutex_unlock(smx_simcall_t simcall, smx_mutex_t mutex)
 smx_cond_t SIMIX_cond_init(void)
 {
   XBT_IN("()");
-  simgrid::simix::Process p;
+  simgrid::simix::ActorImpl p;
   smx_cond_t cond = new s_smx_cond();
   cond->sleeping = xbt_swag_new(xbt_swag_offset(p, synchro_hookup));
   cond->refcount_ = 1;
@@ -393,7 +393,7 @@ void intrusive_ptr_release(s_smx_cond_t *cond)
 smx_sem_t SIMIX_sem_init(unsigned int value)
 {
   XBT_IN("(%u)",value);
-  simgrid::simix::Process p;
+  simgrid::simix::ActorImpl p;
 
   smx_sem_t sem = xbt_new0(s_smx_sem_t, 1);
   sem->sleeping = xbt_swag_new(xbt_swag_offset(p, synchro_hookup));
index 2699169..f28e62d 100644 (file)
@@ -29,7 +29,7 @@ set(EXTRA_DIST
   src/simix/smx_io_private.h
   src/simix/smx_network_private.h
   src/simix/smx_private.h
-  src/simix/smx_process_private.h
+  src/simix/ActorImpl.hpp
   src/simix/smx_synchro_private.h
   src/kernel/activity/Synchro.h
   src/kernel/activity/SynchroComm.hpp
@@ -348,7 +348,7 @@ set(SIMIX_SRC
   src/simix/smx_host.cpp
   src/simix/smx_io.cpp
   src/simix/smx_network.cpp
-  src/simix/smx_process.cpp
+  src/simix/ActorImpl.cpp
   src/simix/smx_synchro.cpp
   src/simix/smx_vm.cpp
   src/simix/popping.cpp