Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
move MailboxImpl to kernel::activity where it belongs
authorMartin Quinson <martin.quinson@loria.fr>
Mon, 13 Feb 2017 22:49:10 +0000 (23:49 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Mon, 13 Feb 2017 23:01:29 +0000 (00:01 +0100)
include/simgrid/s4u/Actor.hpp
include/simgrid/s4u/Mailbox.hpp
include/simgrid/simix.h
src/kernel/activity/MailboxImpl.cpp [moved from src/simix/MailboxImpl.cpp with 95% similarity]
src/kernel/activity/MailboxImpl.hpp [moved from src/simix/MailboxImpl.hpp with 85% similarity]
src/s4u/s4u_mailbox.cpp
src/simix/smx_network_private.h
tools/cmake/DefinePackages.cmake

index 56c644e..11d682c 100644 (file)
@@ -134,7 +134,7 @@ namespace s4u {
 XBT_PUBLIC_CLASS Actor {
   friend Mailbox;
   friend simgrid::simix::ActorImpl;
 XBT_PUBLIC_CLASS Actor {
   friend Mailbox;
   friend simgrid::simix::ActorImpl;
-  friend simgrid::simix::MailboxImpl;
+  friend simgrid::kernel::activity::MailboxImpl;
   simix::ActorImpl* pimpl_ = nullptr;
 
   /** Wrap a (possibly non-copyable) single-use task into a `std::function` */
   simix::ActorImpl* pimpl_ = nullptr;
 
   /** Wrap a (possibly non-copyable) single-use task into a `std::function` */
index 272aa02..9d52198 100644 (file)
@@ -106,11 +106,11 @@ namespace s4u {
 XBT_PUBLIC_CLASS Mailbox {
   friend Comm;
   friend simgrid::s4u::Engine;
 XBT_PUBLIC_CLASS Mailbox {
   friend Comm;
   friend simgrid::s4u::Engine;
-  friend simgrid::simix::MailboxImpl;
+  friend simgrid::kernel::activity::MailboxImpl;
 
 
-  simgrid::simix::MailboxImpl* pimpl_;
+  simgrid::kernel::activity::MailboxImpl* pimpl_;
 
 
-  explicit Mailbox(simix::MailboxImpl * mbox) : pimpl_(mbox) {}
+  explicit Mailbox(kernel::activity::MailboxImpl * mbox) : pimpl_(mbox) {}
 
   /** private function to manage the mailboxes' lifetime (see @ref s4u_raii) */
   friend void intrusive_ptr_add_ref(Mailbox*) {}
 
   /** private function to manage the mailboxes' lifetime (see @ref s4u_raii) */
   friend void intrusive_ptr_add_ref(Mailbox*) {}
@@ -118,7 +118,7 @@ XBT_PUBLIC_CLASS Mailbox {
   friend void intrusive_ptr_release(Mailbox*) {}
 public:
   /** private function, do not use. FIXME: make me protected */
   friend void intrusive_ptr_release(Mailbox*) {}
 public:
   /** private function, do not use. FIXME: make me protected */
-  simix::MailboxImpl* getImpl() { return pimpl_; }
+  kernel::activity::MailboxImpl* getImpl() { return pimpl_; }
 
   /** Gets the name of that mailbox */
   const char *name();
 
   /** Gets the name of that mailbox */
   const char *name();
index 02d8112..4105374 100644 (file)
@@ -19,9 +19,13 @@ namespace kernel {
 namespace context {
   class Context;
   class ContextFactory;
 namespace context {
   class Context;
   class ContextFactory;
-}}
+  }
+  namespace activity {
+  class MailboxImpl;
+  }
+  }
 
 
-namespace simix {
+  namespace simix {
 
   /** @brief Process datatype
       @ingroup simix_process_management
 
   /** @brief Process datatype
       @ingroup simix_process_management
@@ -32,14 +36,13 @@ namespace simix {
     @{ */
   class ActorImpl;
   class Mutex;
     @{ */
   class ActorImpl;
   class Mutex;
-  class MailboxImpl;
 }
 }
 
 typedef simgrid::kernel::context::Context *smx_context_t;
 typedef simgrid::simix::ActorImpl *smx_actor_t;
 typedef simgrid::simix::Mutex   *smx_mutex_t;
 }
 }
 
 typedef simgrid::kernel::context::Context *smx_context_t;
 typedef simgrid::simix::ActorImpl *smx_actor_t;
 typedef simgrid::simix::Mutex   *smx_mutex_t;
-typedef simgrid::simix::MailboxImpl* smx_mailbox_t;
+typedef simgrid::kernel::activity::MailboxImpl* smx_mailbox_t;
 
 #else
 
 
 #else
 
similarity index 95%
rename from src/simix/MailboxImpl.cpp
rename to src/kernel/activity/MailboxImpl.cpp
index 7a19d18..b8ff612 100644 (file)
@@ -3,7 +3,7 @@
 /* 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 "src/simix/MailboxImpl.hpp"
+#include "src/kernel/activity/MailboxImpl.hpp"
 #include "src/kernel/activity/SynchroComm.hpp"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_mailbox, simix, "Mailbox implementation");
 #include "src/kernel/activity/SynchroComm.hpp"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_mailbox, simix, "Mailbox implementation");
@@ -22,7 +22,8 @@ void SIMIX_mailbox_exit()
 /******************************************************************************/
 
 namespace simgrid {
 /******************************************************************************/
 
 namespace simgrid {
-namespace simix {
+namespace kernel {
+namespace activity {
 /** @brief Returns the mailbox of that name, or nullptr */
 MailboxImpl* MailboxImpl::byNameOrNull(const char* name)
 {
 /** @brief Returns the mailbox of that name, or nullptr */
 MailboxImpl* MailboxImpl::byNameOrNull(const char* name)
 {
@@ -35,7 +36,7 @@ MailboxImpl* MailboxImpl::byNameOrCreate(const char* name)
   /* two processes may have pushed the same mbox_create simcall at the same time */
   smx_mailbox_t mbox = static_cast<smx_mailbox_t>(xbt_dict_get_or_null(mailboxes, name));
   if (!mbox) {
   /* two processes may have pushed the same mbox_create simcall at the same time */
   smx_mailbox_t mbox = static_cast<smx_mailbox_t>(xbt_dict_get_or_null(mailboxes, name));
   if (!mbox) {
-    mbox = new simgrid::simix::MailboxImpl(name);
+    mbox = new MailboxImpl(name);
     XBT_DEBUG("Creating a mailbox at %p with name %s", mbox, name);
     xbt_dict_set(mailboxes, mbox->name_, mbox, nullptr);
   }
     XBT_DEBUG("Creating a mailbox at %p with name %s", mbox, name);
     xbt_dict_set(mailboxes, mbox->name_, mbox, nullptr);
   }
@@ -75,3 +76,4 @@ void MailboxImpl::remove(smx_activity_t activity)
 }
 }
 }
 }
 }
 }
+}
similarity index 85%
rename from src/simix/MailboxImpl.hpp
rename to src/kernel/activity/MailboxImpl.hpp
index 4fb573f..f62d326 100644 (file)
 
 #define MAX_MAILBOX_SIZE 10000000
 namespace simgrid {
 
 #define MAX_MAILBOX_SIZE 10000000
 namespace simgrid {
-namespace simix {
+namespace kernel {
+namespace activity {
 
 
-/** @brief Rendez-vous point datatype */
+/** @brief Implementation of the simgrid::s4u::Mailbox */
 
 class MailboxImpl {
   explicit MailboxImpl(const char* name)
 
 class MailboxImpl {
   explicit MailboxImpl(const char* name)
@@ -34,12 +35,13 @@ public:
   simgrid::s4u::Mailbox piface_; // Our interface
   char* name_;
 
   simgrid::s4u::Mailbox piface_; // Our interface
   char* name_;
 
-  boost::intrusive_ptr<simgrid::simix::ActorImpl> permanent_receiver; //process which the mailbox is attached to
+  boost::intrusive_ptr<simgrid::simix::ActorImpl> permanent_receiver; // process which the mailbox is attached to
   boost::circular_buffer_space_optimized<smx_activity_t> comm_queue;
   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> done_comm_queue; // messages already received in the permanent receive mode
 };
 }
 }
 };
 }
 }
+}
 
 XBT_PRIVATE void SIMIX_mailbox_exit();
 
 
 XBT_PRIVATE void SIMIX_mailbox_exit();
 
index ed78c03..2fa5db2 100644 (file)
@@ -22,10 +22,10 @@ const char *Mailbox::name() {
 
 MailboxPtr Mailbox::byName(const char*name)
 {
 
 MailboxPtr Mailbox::byName(const char*name)
 {
-  simix::MailboxImpl* mbox = simix::MailboxImpl::byNameOrNull(name);
+  kernel::activity::MailboxImpl* mbox = kernel::activity::MailboxImpl::byNameOrNull(name);
   if (mbox == nullptr) {
     mbox = simix::kernelImmediate([name] {
   if (mbox == nullptr) {
     mbox = simix::kernelImmediate([name] {
-      return simix::MailboxImpl::byNameOrCreate(name);
+      return kernel::activity::MailboxImpl::byNameOrCreate(name);
     });
   }
   return MailboxPtr(&mbox->piface_, true);
     });
   }
   return MailboxPtr(&mbox->piface_, true);
index e40096b..c238e2e 100644 (file)
@@ -8,8 +8,8 @@
 #define _SIMIX_NETWORK_PRIVATE_H
 
 #include "simgrid/s4u/Mailbox.hpp"
 #define _SIMIX_NETWORK_PRIVATE_H
 
 #include "simgrid/s4u/Mailbox.hpp"
+#include "src/kernel/activity/MailboxImpl.hpp"
 #include "src/simix/ActorImpl.hpp"
 #include "src/simix/ActorImpl.hpp"
-#include "src/simix/MailboxImpl.hpp"
 
 XBT_PRIVATE smx_activity_t SIMIX_comm_irecv(smx_actor_t dst_proc, smx_mailbox_t mbox,
                               void *dst_buff, size_t *dst_buff_size,
 
 XBT_PRIVATE smx_activity_t SIMIX_comm_irecv(smx_actor_t dst_proc, smx_mailbox_t mbox,
                               void *dst_buff, size_t *dst_buff_size,
index 51f098d..28f94dd 100644 (file)
@@ -362,11 +362,11 @@ set(SIMIX_SRC
   src/simix/smx_network.cpp
   src/simix/ActorImpl.cpp
   src/simix/ActorImpl.hpp
   src/simix/smx_network.cpp
   src/simix/ActorImpl.cpp
   src/simix/ActorImpl.hpp
-  src/simix/MailboxImpl.cpp
-  src/simix/MailboxImpl.hpp
   src/simix/smx_synchro.cpp
   src/simix/popping.cpp
   src/kernel/activity/ActivityImpl.cpp
   src/simix/smx_synchro.cpp
   src/simix/popping.cpp
   src/kernel/activity/ActivityImpl.cpp
+  src/kernel/activity/MailboxImpl.cpp
+  src/kernel/activity/MailboxImpl.hpp
   src/kernel/activity/SynchroComm.cpp
   src/kernel/activity/SynchroExec.cpp
   src/kernel/activity/SynchroSleep.cpp
   src/kernel/activity/SynchroComm.cpp
   src/kernel/activity/SynchroExec.cpp
   src/kernel/activity/SynchroSleep.cpp