Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
move simix::ActorImpl to kernel::actor::ActorImpl
authorMartin Quinson <martin.quinson@loria.fr>
Sun, 25 Mar 2018 15:36:02 +0000 (17:36 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Sun, 25 Mar 2018 15:36:02 +0000 (17:36 +0200)
15 files changed:
include/simgrid/forward.h
include/simgrid/s4u/Actor.hpp
include/simgrid/simix.hpp
src/kernel/activity/MailboxImpl.hpp
src/kernel/activity/MutexImpl.hpp
src/plugins/vm/VirtualMachineImpl.hpp
src/s4u/s4u_actor.cpp
src/simix/ActorImpl.cpp
src/simix/ActorImpl.hpp
src/simix/smx_global.cpp
src/simix/smx_host.cpp
src/simix/smx_host_private.hpp
src/simix/smx_private.hpp
src/simix/smx_synchro_private.hpp
src/surf/sg_platf.cpp

index 69ef8e4..4ab1b7f 100644 (file)
@@ -20,6 +20,10 @@ namespace context {
 class Context;
 class ContextFactory;
 }
 class Context;
 class ContextFactory;
 }
+namespace actor {
+class ActorImpl;
+using ActorImplPtr = boost::intrusive_ptr<ActorImpl>;
+} // namespace actor
 namespace activity {
   class ActivityImpl;
   using ActivityImplPtr = boost::intrusive_ptr<ActivityImpl>;
 namespace activity {
   class ActivityImpl;
   using ActivityImplPtr = boost::intrusive_ptr<ActivityImpl>;
@@ -63,8 +67,6 @@ class RouteCreationArgs;
 }
 }
 namespace simix {
 }
 }
 namespace simix {
-  class ActorImpl;
-  using ActorImplPtr = boost::intrusive_ptr<ActorImpl>;
   class Host;
 }
 
   class Host;
 }
 
@@ -94,7 +96,7 @@ typedef simgrid::kernel::resource::Resource surf_Resource;
 typedef simgrid::trace_mgr::trace tmgr_Trace;
 
 typedef simgrid::kernel::context::Context* smx_context_t;
 typedef simgrid::trace_mgr::trace tmgr_Trace;
 
 typedef simgrid::kernel::context::Context* smx_context_t;
-typedef simgrid::simix::ActorImpl* smx_actor_t;
+typedef simgrid::kernel::actor::ActorImpl* smx_actor_t;
 typedef simgrid::kernel::activity::MutexImpl* smx_mutex_t;
 typedef simgrid::kernel::activity::MailboxImpl* smx_mailbox_t;
 typedef simgrid::surf::StorageImpl* surf_storage_t;
 typedef simgrid::kernel::activity::MutexImpl* smx_mutex_t;
 typedef simgrid::kernel::activity::MailboxImpl* smx_mailbox_t;
 typedef simgrid::surf::StorageImpl* surf_storage_t;
index 8d3a99f..e1b47f3 100644 (file)
@@ -132,9 +132,9 @@ namespace s4u {
 class XBT_PUBLIC Actor : public simgrid::xbt::Extendable<Actor> {
   friend Exec;
   friend Mailbox;
 class XBT_PUBLIC Actor : public simgrid::xbt::Extendable<Actor> {
   friend Exec;
   friend Mailbox;
-  friend simgrid::simix::ActorImpl;
+  friend simgrid::kernel::actor::ActorImpl;
   friend simgrid::kernel::activity::MailboxImpl;
   friend simgrid::kernel::activity::MailboxImpl;
-  simix::ActorImpl* pimpl_ = nullptr;
+  kernel::actor::ActorImpl* pimpl_ = nullptr;
 
   /** Wrap a (possibly non-copyable) single-use task into a `std::function` */
   template<class F, class... Args>
 
   /** Wrap a (possibly non-copyable) single-use task into a `std::function` */
   template<class F, class... Args>
@@ -276,7 +276,7 @@ public:
   static void killAll(int resetPid);
 
   /** Returns the internal implementation of this actor */
   static void killAll(int resetPid);
 
   /** Returns the internal implementation of this actor */
-  simix::ActorImpl* getImpl();
+  kernel::actor::ActorImpl* getImpl();
 
   /** Retrieve the property value (or nullptr if not set) */
   std::map<std::string, std::string>* getProperties();
 
   /** Retrieve the property value (or nullptr if not set) */
   std::map<std::string, std::string>* getProperties();
index 0eb3375..0e952a5 100644 (file)
@@ -71,9 +71,6 @@ typename std::result_of<F()>::type kernelImmediate(F&& code)
 
 XBT_PUBLIC const std::vector<smx_actor_t>& process_get_runnable();
 
 
 XBT_PUBLIC const std::vector<smx_actor_t>& process_get_runnable();
 
-XBT_PUBLIC void set_maestro(std::function<void()> code);
-XBT_PUBLIC void create_maestro(std::function<void()> code);
-
 // What's executed as SIMIX actor code:
 typedef std::function<void()> ActorCode;
 
 // What's executed as SIMIX actor code:
 typedef std::function<void()> ActorCode;
 
index 2039f25..4bfffe8 100644 (file)
@@ -37,7 +37,7 @@ public:
   simgrid::s4u::Mailbox piface_; // Our interface
   simgrid::xbt::string name_;
 
   simgrid::s4u::Mailbox piface_; // Our interface
   simgrid::xbt::string name_;
 
-  simgrid::simix::ActorImplPtr permanent_receiver; // process to which the mailbox is attached
+  simgrid::kernel::actor::ActorImplPtr permanent_receiver; // actor to which the mailbox is attached
   boost::circular_buffer_space_optimized<smx_activity_t> comm_queue;
   boost::circular_buffer_space_optimized<smx_activity_t> done_comm_queue; // messages already received in the permanent receive mode
 };
   boost::circular_buffer_space_optimized<smx_activity_t> comm_queue;
   boost::circular_buffer_space_optimized<smx_activity_t> done_comm_queue; // messages already received in the permanent receive mode
 };
index fb90e8e..53543b6 100644 (file)
@@ -28,7 +28,7 @@ public:
   bool locked       = false;
   smx_actor_t owner = nullptr;
   // List of sleeping processes:
   bool locked       = false;
   smx_actor_t owner = nullptr;
   // List of sleeping processes:
-  simgrid::simix::SynchroList sleeping;
+  simgrid::kernel::actor::SynchroList sleeping;
 
   // boost::intrusive_ptr<Mutex> support:
   friend void intrusive_ptr_add_ref(MutexImpl* mutex)
 
   // boost::intrusive_ptr<Mutex> support:
   friend void intrusive_ptr_add_ref(MutexImpl* mutex)
index 0be3938..e567125 100644 (file)
@@ -35,13 +35,13 @@ public:
   ~VirtualMachineImpl();
 
   /** @brief Suspend the VM */
   ~VirtualMachineImpl();
 
   /** @brief Suspend the VM */
-  virtual void suspend(simgrid::simix::ActorImpl* issuer);
+  virtual void suspend(simgrid::kernel::actor::ActorImpl* issuer);
 
   /** @brief Resume the VM */
   virtual void resume();
 
   /** @brief Shutdown the VM */
 
   /** @brief Resume the VM */
   virtual void resume();
 
   /** @brief Shutdown the VM */
-  virtual void shutdown(simgrid::simix::ActorImpl* issuer);
+  virtual void shutdown(simgrid::kernel::actor::ActorImpl* issuer);
 
   /** @brief Change the physical host on which the given VM is running */
   virtual void setPm(s4u::Host* dest);
 
   /** @brief Change the physical host on which the given VM is running */
   virtual void setPm(s4u::Host* dest);
index 653bf8c..0f329ae 100644 (file)
@@ -36,7 +36,7 @@ ActorPtr Actor::self()
 
 ActorPtr Actor::createActor(const char* name, s4u::Host* host, std::function<void()> code)
 {
 
 ActorPtr Actor::createActor(const char* name, s4u::Host* host, std::function<void()> code)
 {
-  simgrid::simix::ActorImpl* actor = simcall_process_create(name, std::move(code), nullptr, host, nullptr);
+  simgrid::kernel::actor::ActorImpl* actor = simcall_process_create(name, std::move(code), nullptr, host, nullptr);
   return actor->iface();
 }
 
   return actor->iface();
 }
 
@@ -44,7 +44,7 @@ ActorPtr Actor::createActor(const char* name, s4u::Host* host, const char* funct
 {
   simgrid::simix::ActorCodeFactory& factory = SIMIX_get_actor_code_factory(function);
   simgrid::simix::ActorCode code = factory(std::move(args));
 {
   simgrid::simix::ActorCodeFactory& factory = SIMIX_get_actor_code_factory(function);
   simgrid::simix::ActorCode code = factory(std::move(args));
-  simgrid::simix::ActorImpl* actor          = simcall_process_create(name, std::move(code), nullptr, host, nullptr);
+  simgrid::kernel::actor::ActorImpl* actor  = simcall_process_create(name, std::move(code), nullptr, host, nullptr);
   return actor->iface();
 }
 
   return actor->iface();
 }
 
index 95cec9d..8d94d4e 100644 (file)
@@ -146,7 +146,8 @@ void SIMIX_process_empty_trash()
 
 namespace simgrid {
 
 
 namespace simgrid {
 
-namespace simix {
+namespace kernel {
+namespace actor {
 
 ActorImpl::~ActorImpl()
 {
 
 ActorImpl::~ActorImpl()
 {
@@ -182,7 +183,7 @@ simgrid::s4u::Actor* ActorImpl::restart()
 
   // retrieve the arguments of the old process
   // FIXME: Factorize this with SIMIX_host_add_auto_restart_process ?
 
   // retrieve the arguments of the old process
   // FIXME: Factorize this with SIMIX_host_add_auto_restart_process ?
-  simgrid::simix::ProcessArg arg;
+  simgrid::kernel::actor::ProcessArg arg;
   arg.name         = name;
   arg.code         = code;
   arg.host         = host;
   arg.name         = name;
   arg.code         = code;
   arg.host         = host;
@@ -264,7 +265,7 @@ void create_maestro(std::function<void()> code)
 {
   smx_actor_t maestro = nullptr;
   /* Create maestro process and initialize it */
 {
   smx_actor_t maestro = nullptr;
   /* Create maestro process and initialize it */
-  maestro = new simgrid::simix::ActorImpl();
+  maestro           = new simgrid::kernel::actor::ActorImpl();
   maestro->pid = simix_process_maxpid++;
   maestro->name = "";
   maestro->userdata = nullptr;
   maestro->pid = simix_process_maxpid++;
   maestro->name = "";
   maestro->userdata = nullptr;
@@ -281,13 +282,14 @@ void create_maestro(std::function<void()> code)
   simix_global->maestro_process = maestro;
 }
 
   simix_global->maestro_process = maestro;
 }
 
+} // namespace actor
 }
 }
 
 /** @brief Creates and runs the maestro process */
 void SIMIX_maestro_create(void (*code)(void*), void* data)
 {
 }
 }
 
 /** @brief Creates and runs the maestro process */
 void SIMIX_maestro_create(void (*code)(void*), void* data)
 {
-  simgrid::simix::create_maestro(std::bind(code, data));
+  simgrid::kernel::actor::create_maestro(std::bind(code, data));
 }
 
 /**
 }
 
 /**
@@ -310,7 +312,7 @@ smx_actor_t SIMIX_process_create(const char* name, std::function<void()> code, v
     return nullptr;
   }
 
     return nullptr;
   }
 
-  smx_actor_t process = new simgrid::simix::ActorImpl();
+  smx_actor_t process = new simgrid::kernel::actor::ActorImpl();
 
   xbt_assert(code && host != nullptr, "Invalid parameters");
   /* Process data */
 
   xbt_assert(code && host != nullptr, "Invalid parameters");
   /* Process data */
@@ -372,7 +374,7 @@ smx_actor_t SIMIX_process_attach(const char* name, void* data, const char* hostn
     return nullptr;
   }
 
     return nullptr;
   }
 
-  smx_actor_t process = new simgrid::simix::ActorImpl();
+  smx_actor_t process = new simgrid::kernel::actor::ActorImpl();
   /* Process data */
   process->pid = simix_process_maxpid++;
   process->name = std::string(name);
   /* Process data */
   process->pid = simix_process_maxpid++;
   process->name = std::string(name);
index 942064c..f80b0e6 100644 (file)
@@ -19,7 +19,8 @@ struct s_smx_process_exit_fun_t {
 };
 
 namespace simgrid {
 };
 
 namespace simgrid {
-namespace simix {
+namespace kernel {
+namespace actor {
 
 class ProcessArg {
 public:
 
 class ProcessArg {
 public:
@@ -127,10 +128,14 @@ public:
 typedef boost::intrusive::list<ActorImpl, boost::intrusive::member_hook<ActorImpl, boost::intrusive::list_member_hook<>,
                                                                         &ActorImpl::smx_synchro_hook>>
     SynchroList;
 typedef boost::intrusive::list<ActorImpl, boost::intrusive::member_hook<ActorImpl, boost::intrusive::list_member_hook<>,
                                                                         &ActorImpl::smx_synchro_hook>>
     SynchroList;
+
+XBT_PUBLIC void set_maestro(std::function<void()> code);
+XBT_PUBLIC void create_maestro(std::function<void()> code);
 }
 }
-}
+} // namespace kernel
+} // namespace simgrid
 
 
-typedef simgrid::simix::ActorImpl* smx_actor_t;
+typedef simgrid::kernel::actor::ActorImpl* smx_actor_t;
 
 extern "C" {
 
 
 extern "C" {
 
index f813a39..809323c 100644 (file)
@@ -220,7 +220,7 @@ void SIMIX_global_init(int *argc, char **argv)
 
     // Either create a new context with maestro or create
     // a context object with the current context mestro):
 
     // Either create a new context with maestro or create
     // a context object with the current context mestro):
-    simgrid::simix::create_maestro(maestro_code);
+    simgrid::kernel::actor::create_maestro(maestro_code);
 
     /* Prepare to display some more info when dying on Ctrl-C pressing */
     signal(SIGINT, inthandler);
 
     /* Prepare to display some more info when dying on Ctrl-C pressing */
     signal(SIGINT, inthandler);
index a51febd..7872929 100644 (file)
@@ -106,8 +106,8 @@ void SIMIX_host_add_auto_restart_process(sg_host_t host, const char* name, std::
                                          double kill_time, std::map<std::string, std::string>* properties,
                                          int auto_restart)
 {
                                          double kill_time, std::map<std::string, std::string>* properties,
                                          int auto_restart)
 {
-  simgrid::simix::ProcessArg* arg =
-      new simgrid::simix::ProcessArg(name, code, data, host, kill_time, nullptr, auto_restart);
+  simgrid::kernel::actor::ProcessArg* arg =
+      new simgrid::kernel::actor::ProcessArg(name, code, data, host, kill_time, nullptr, auto_restart);
   arg->properties.reset(properties, [](decltype(properties)) {});
 
   if (host->isOff() && watched_hosts.find(host->getCname()) == watched_hosts.end()) {
   arg->properties.reset(properties, [](decltype(properties)) {});
 
   if (host->isOff() && watched_hosts.find(host->getCname()) == watched_hosts.end()) {
@@ -121,7 +121,7 @@ void SIMIX_host_add_auto_restart_process(sg_host_t host, const char* name, std::
 /** @brief Restart the list of processes that have been registered to the host */
 void SIMIX_host_autorestart(sg_host_t host)
 {
 /** @brief Restart the list of processes that have been registered to the host */
 void SIMIX_host_autorestart(sg_host_t host)
 {
-  std::vector<simgrid::simix::ProcessArg*> process_list =
+  std::vector<simgrid::kernel::actor::ProcessArg*> process_list =
       host->extension<simgrid::simix::Host>()->auto_restart_processes;
 
   for (auto const& arg : process_list) {
       host->extension<simgrid::simix::Host>()->auto_restart_processes;
 
   for (auto const& arg : process_list) {
index 899fab3..00f681a 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2018. 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. */
 
 /* 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. */
@@ -31,11 +31,12 @@ public:
   explicit Host();
   virtual ~Host();
 
   explicit Host();
   virtual ~Host();
 
-  boost::intrusive::list<ActorImpl, boost::intrusive::member_hook<ActorImpl, boost::intrusive::list_member_hook<>,
-                                                                  &ActorImpl::host_process_list_hook>>
+  boost::intrusive::list<kernel::actor::ActorImpl,
+                         boost::intrusive::member_hook<kernel::actor::ActorImpl, boost::intrusive::list_member_hook<>,
+                                                       &kernel::actor::ActorImpl::host_process_list_hook>>
       process_list;
       process_list;
-  std::vector<ProcessArg*> auto_restart_processes;
-  std::vector<ProcessArg*> boot_processes;
+  std::vector<kernel::actor::ProcessArg*> auto_restart_processes;
+  std::vector<kernel::actor::ProcessArg*> boot_processes;
 
   void turnOn();
 };
 
   void turnOn();
 };
index 1dc37d7..e6cc998 100644 (file)
@@ -27,8 +27,9 @@ public:
   std::vector<smx_actor_t> process_to_run;
   std::vector<smx_actor_t> process_that_ran;
   std::map<aid_t, smx_actor_t> process_list;
   std::vector<smx_actor_t> process_to_run;
   std::vector<smx_actor_t> process_that_ran;
   std::map<aid_t, smx_actor_t> process_list;
-  boost::intrusive::list<ActorImpl, boost::intrusive::member_hook<ActorImpl, boost::intrusive::list_member_hook<>,
-                                                                  &ActorImpl::smx_destroy_list_hook>>
+  boost::intrusive::list<kernel::actor::ActorImpl,
+                         boost::intrusive::member_hook<kernel::actor::ActorImpl, boost::intrusive::list_member_hook<>,
+                                                       &kernel::actor::ActorImpl::smx_destroy_list_hook>>
       process_to_destroy;
 #if SIMGRID_HAVE_MC
   /* MCer cannot read members process_list and process_to_destroy above in the remote process, so we copy the info it
       process_to_destroy;
 #if SIMGRID_HAVE_MC
   /* MCer cannot read members process_list and process_to_destroy above in the remote process, so we copy the info it
@@ -59,7 +60,7 @@ public:
   std::vector<simgrid::xbt::Task<void()>> tasks;
   std::vector<simgrid::xbt::Task<void()>> tasksTemp;
 
   std::vector<simgrid::xbt::Task<void()>> tasks;
   std::vector<simgrid::xbt::Task<void()>> tasksTemp;
 
-  std::vector<simgrid::simix::ActorImpl*> daemons;
+  std::vector<simgrid::kernel::actor::ActorImpl*> daemons;
 };
 }
 }
 };
 }
 }
@@ -74,13 +75,13 @@ XBT_PUBLIC void SIMIX_clean();
 /** @brief Ask to the provided ActorImpl to raise the provided exception */
 #define SMX_EXCEPTION(issuer, cat, val, msg)                                                                           \
   if (1) {                                                                                                             \
 /** @brief Ask to the provided ActorImpl to raise the provided exception */
 #define SMX_EXCEPTION(issuer, cat, val, msg)                                                                           \
   if (1) {                                                                                                             \
-    simgrid::simix::ActorImpl* _smx_throw_issuer = (issuer); /* evaluate only once */                                  \
+    simgrid::kernel::actor::ActorImpl* _smx_throw_issuer = (issuer); /* evaluate only once */                          \
     xbt_ex e(XBT_THROW_POINT, msg);                                                                                    \
     e.category                   = cat;                                                                                \
     e.value                      = val;                                                                                \
     _smx_throw_issuer->exception = std::make_exception_ptr(e);                                                         \
   } else                                                                                                               \
     xbt_ex e(XBT_THROW_POINT, msg);                                                                                    \
     e.category                   = cat;                                                                                \
     e.value                      = val;                                                                                \
     _smx_throw_issuer->exception = std::make_exception_ptr(e);                                                         \
   } else                                                                                                               \
-  ((void)0)
+    ((void)0)
 }
 
 #endif
 }
 
 #endif
index ed15fd1..76f8a9c 100644 (file)
@@ -17,13 +17,13 @@ struct s_smx_cond_t {
 
   std::atomic_int_fast32_t refcount_{1};
   smx_mutex_t mutex   = nullptr;
 
   std::atomic_int_fast32_t refcount_{1};
   smx_mutex_t mutex   = nullptr;
-  simgrid::simix::SynchroList sleeping; /* list of sleeping processes */
+  simgrid::kernel::actor::SynchroList sleeping; /* list of sleeping processes */
   simgrid::s4u::ConditionVariable cond_;
 };
 
 struct s_smx_sem_t {
   unsigned int value;
   simgrid::s4u::ConditionVariable cond_;
 };
 
 struct s_smx_sem_t {
   unsigned int value;
-  simgrid::simix::SynchroList sleeping; /* list of sleeping processes */
+  simgrid::kernel::actor::SynchroList sleeping; /* list of sleeping processes */
 };
 
 XBT_PRIVATE void SIMIX_synchro_stop_waiting(smx_actor_t process, smx_simcall_t simcall);
 };
 
 XBT_PRIVATE void SIMIX_synchro_stop_waiting(smx_actor_t process, smx_simcall_t simcall);
index 80ce1a6..1644840 100644 (file)
@@ -440,14 +440,14 @@ void sg_platf_new_actor(simgrid::kernel::routing::ActorCreationArgs* actor)
   std::function<void()> code = factory(std::move(actor->args));
   std::shared_ptr<std::map<std::string, std::string>> properties(actor->properties);
 
   std::function<void()> code = factory(std::move(actor->args));
   std::shared_ptr<std::map<std::string, std::string>> properties(actor->properties);
 
-  simgrid::simix::ProcessArg* arg =
-      new simgrid::simix::ProcessArg(actor_name, code, nullptr, host, kill_time, properties, auto_restart);
+  simgrid::kernel::actor::ProcessArg* arg =
+      new simgrid::kernel::actor::ProcessArg(actor_name, code, nullptr, host, kill_time, properties, auto_restart);
 
   host->extension<simgrid::simix::Host>()->boot_processes.push_back(arg);
 
   if (start_time > SIMIX_get_clock()) {
 
 
   host->extension<simgrid::simix::Host>()->boot_processes.push_back(arg);
 
   if (start_time > SIMIX_get_clock()) {
 
-    arg = new simgrid::simix::ProcessArg(actor_name, code, nullptr, host, kill_time, properties, auto_restart);
+    arg = new simgrid::kernel::actor::ProcessArg(actor_name, code, nullptr, host, kill_time, properties, auto_restart);
 
     XBT_DEBUG("Process %s@%s will be started at time %f", arg->name.c_str(), arg->host->getCname(), start_time);
     SIMIX_timer_set(start_time, [arg, auto_restart]() {
 
     XBT_DEBUG("Process %s@%s will be started at time %f", arg->name.c_str(), arg->host->getCname(), start_time);
     SIMIX_timer_set(start_time, [arg, auto_restart]() {