Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
rename simix::Mutex to simix::MutexImpl
authorMartin Quinson <martin.quinson@loria.fr>
Wed, 24 May 2017 12:10:52 +0000 (14:10 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Wed, 24 May 2017 12:10:52 +0000 (14:10 +0200)
examples/smpi/mc/bugged1.c
include/simgrid/s4u/Mutex.hpp
include/simgrid/simix.h
src/mc/mc_base.cpp
src/mc/mc_request.cpp
src/s4u/s4u_actor.cpp
src/simix/smx_synchro.cpp
src/simix/smx_synchro_private.h

index 9abacce..3d2e0e9 100644 (file)
@@ -33,7 +33,7 @@ int main(int argc, char **argv)
   if (rank == 0) {
     printf("MPI_ISend / MPI_IRecv Test \n");
 
-    for(int i=0; i < size - 1; i++){
+    for (int i = 0; i < size - 1; i++) {
       MPI_Recv(&recv_buff, 1, MPI_INT, MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &status);
       printf("Message received from %d\n", recv_buff);
     }
index 3603d18..05199bd 100644 (file)
@@ -35,9 +35,9 @@ class ConditionVariable;
  */
 XBT_PUBLIC_CLASS Mutex {
   friend ConditionVariable;
-  friend simgrid::simix::Mutex;
-  simgrid::simix::Mutex* mutex_;
-  Mutex(simgrid::simix::Mutex* mutex) : mutex_(mutex) {}
+  friend simgrid::simix::MutexImpl;
+  simgrid::simix::MutexImpl* mutex_;
+  Mutex(simgrid::simix::MutexImpl * mutex) : mutex_(mutex) {}
 
   /* refcounting of the intrusive_ptr is delegated to the implementation object */
   friend void intrusive_ptr_add_ref(Mutex* mutex)
index 3f0e836..78dbe75 100644 (file)
@@ -34,13 +34,13 @@ namespace context {
       \see m_process_management
     @{ */
   class ActorImpl;
-  class Mutex;
+  class MutexImpl;
 }
 }
 
 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::MutexImpl* smx_mutex_t;
 typedef simgrid::kernel::activity::MailboxImpl* smx_mailbox_t;
 
 #else
index ac27ff0..4bc39eb 100644 (file)
@@ -154,7 +154,7 @@ bool request_is_enabled(smx_simcall_t req)
   case SIMCALL_MUTEX_LOCK: {
     smx_mutex_t mutex = simcall_mutex_lock__get__mutex(req);
 #if SIMGRID_HAVE_MC
-    simgrid::mc::Remote<simgrid::simix::Mutex> temp_mutex;
+    simgrid::mc::Remote<simgrid::simix::MutexImpl> temp_mutex;
     if (mc_model_checker != nullptr) {
       mc_model_checker->process().read(temp_mutex.getBuffer(), remote(mutex));
       mutex = temp_mutex.getBuffer();
index bdc6b32..f8c4cf2 100644 (file)
@@ -365,7 +365,7 @@ std::string simgrid::mc::request_to_string(smx_simcall_t req, int value, simgrid
     else
       type = "Mutex TRYLOCK";
 
-    simgrid::mc::Remote<simgrid::simix::Mutex> mutex;
+    simgrid::mc::Remote<simgrid::simix::MutexImpl> mutex;
     mc_model_checker->process().read_bytes(mutex.getBuffer(), sizeof(mutex),
       remote(
         req->call == SIMCALL_MUTEX_LOCK
index 4841225..1338b82 100644 (file)
@@ -29,7 +29,7 @@ ActorPtr Actor::self()
 
 ActorPtr Actor::createActor(const char* name, s4u::Host* host, std::function<void()> code)
 {
-  smx_actor_t actor = simcall_process_create(name, std::move(code), nullptr, host, nullptr);
+  simgrid::simix::ActorImpl* actor = simcall_process_create(name, std::move(code), nullptr, host, nullptr);
   return actor->iface();
 }
 
@@ -37,7 +37,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));
-  smx_actor_t actor                         = simcall_process_create(name, std::move(code), nullptr, host, nullptr);
+  simgrid::simix::ActorImpl* actor          = simcall_process_create(name, std::move(code), nullptr, host, nullptr);
   return actor->iface();
 }
 
index 35b240f..2095a4c 100644 (file)
@@ -98,7 +98,7 @@ void SIMIX_synchro_finish(smx_activity_t synchro)
 namespace simgrid {
 namespace simix {
 
-Mutex::Mutex() : mutex_(this)
+MutexImpl::MutexImpl() : mutex_(this)
 {
   XBT_IN("(%p)", this);
   // Useful to initialize sleeping swag:
@@ -107,14 +107,14 @@ Mutex::Mutex() : mutex_(this)
   XBT_OUT();
 }
 
-Mutex::~Mutex()
+MutexImpl::~MutexImpl()
 {
   XBT_IN("(%p)", this);
   xbt_swag_free(this->sleeping);
   XBT_OUT();
 }
 
-void Mutex::lock(smx_actor_t issuer)
+void MutexImpl::lock(smx_actor_t issuer)
 {
   XBT_IN("(%p; %p)", this, issuer);
   /* FIXME: check where to validate the arguments */
@@ -141,7 +141,7 @@ void Mutex::lock(smx_actor_t issuer)
  * \param  issuer  the process that tries to acquire the mutex
  * \return whether we managed to lock the mutex
  */
-bool Mutex::try_lock(smx_actor_t issuer)
+bool MutexImpl::try_lock(smx_actor_t issuer)
 {
   XBT_IN("(%p, %p)", this, issuer);
   if (this->locked) {
@@ -161,7 +161,7 @@ bool Mutex::try_lock(smx_actor_t issuer)
  * If the unlocker is not the owner of the mutex nothing happens.
  * If there are no process waiting, it sets the mutex as free.
  */
-void Mutex::unlock(smx_actor_t issuer)
+void MutexImpl::unlock(smx_actor_t issuer)
 {
   XBT_IN("(%p, %p)", this, issuer);
   if (not this->locked)
@@ -207,7 +207,7 @@ void SIMIX_mutex_unref(smx_mutex_t mutex)
 
 smx_mutex_t simcall_HANDLER_mutex_init(smx_simcall_t simcall)
 {
-  return new simgrid::simix::Mutex();
+  return new simgrid::simix::MutexImpl();
 }
 
 // Simcall handlers:
index c4c5371..37b5f13 100644 (file)
 namespace simgrid {
 namespace simix {
 
-class XBT_PUBLIC() Mutex {
+class XBT_PUBLIC() MutexImpl {
 public:
-  Mutex();
-  ~Mutex();
-  Mutex(Mutex const&) = delete;
-  Mutex& operator=(Mutex const&) = delete;
+  MutexImpl();
+  ~MutexImpl();
+  MutexImpl(MutexImpl const&) = delete;
+  MutexImpl& operator=(MutexImpl const&) = delete;
 
   void lock(smx_actor_t issuer);
   bool try_lock(smx_actor_t issuer);
@@ -29,14 +29,14 @@ public:
   xbt_swag_t sleeping = nullptr;
 
   // boost::intrusive_ptr<Mutex> support:
-  friend void intrusive_ptr_add_ref(Mutex* mutex)
+  friend void intrusive_ptr_add_ref(MutexImpl* mutex)
   {
     // Atomic operation! Do not split in two instructions!
     auto previous = (mutex->refcount_)++;
     xbt_assert(previous != 0);
     (void) previous;
   }
-  friend void intrusive_ptr_release(Mutex* mutex)
+  friend void intrusive_ptr_release(MutexImpl* mutex)
   {
     // Atomic operation! Do not split in two instructions!
     auto count = --(mutex->refcount_);