From a4ebb6917b0c05404f2444620b7230f3a9c0f262 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Wed, 24 May 2017 14:10:52 +0200 Subject: [PATCH] rename simix::Mutex to simix::MutexImpl --- examples/smpi/mc/bugged1.c | 2 +- include/simgrid/s4u/Mutex.hpp | 6 +++--- include/simgrid/simix.h | 4 ++-- src/mc/mc_base.cpp | 2 +- src/mc/mc_request.cpp | 2 +- src/s4u/s4u_actor.cpp | 4 ++-- src/simix/smx_synchro.cpp | 12 ++++++------ src/simix/smx_synchro_private.h | 14 +++++++------- 8 files changed, 23 insertions(+), 23 deletions(-) diff --git a/examples/smpi/mc/bugged1.c b/examples/smpi/mc/bugged1.c index 9abacce696..3d2e0e9d64 100644 --- a/examples/smpi/mc/bugged1.c +++ b/examples/smpi/mc/bugged1.c @@ -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); } diff --git a/include/simgrid/s4u/Mutex.hpp b/include/simgrid/s4u/Mutex.hpp index 3603d18359..05199bd889 100644 --- a/include/simgrid/s4u/Mutex.hpp +++ b/include/simgrid/s4u/Mutex.hpp @@ -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) diff --git a/include/simgrid/simix.h b/include/simgrid/simix.h index 3f0e836533..78dbe75a3d 100644 --- a/include/simgrid/simix.h +++ b/include/simgrid/simix.h @@ -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 diff --git a/src/mc/mc_base.cpp b/src/mc/mc_base.cpp index ac27ff05dc..4bc39eb2a2 100644 --- a/src/mc/mc_base.cpp +++ b/src/mc/mc_base.cpp @@ -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 temp_mutex; + simgrid::mc::Remote temp_mutex; if (mc_model_checker != nullptr) { mc_model_checker->process().read(temp_mutex.getBuffer(), remote(mutex)); mutex = temp_mutex.getBuffer(); diff --git a/src/mc/mc_request.cpp b/src/mc/mc_request.cpp index bdc6b3230c..f8c4cf2d3d 100644 --- a/src/mc/mc_request.cpp +++ b/src/mc/mc_request.cpp @@ -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 mutex; + simgrid::mc::Remote mutex; mc_model_checker->process().read_bytes(mutex.getBuffer(), sizeof(mutex), remote( req->call == SIMCALL_MUTEX_LOCK diff --git a/src/s4u/s4u_actor.cpp b/src/s4u/s4u_actor.cpp index 48412257b0..1338b825ac 100644 --- a/src/s4u/s4u_actor.cpp +++ b/src/s4u/s4u_actor.cpp @@ -29,7 +29,7 @@ ActorPtr Actor::self() ActorPtr Actor::createActor(const char* name, s4u::Host* host, std::function 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(); } diff --git a/src/simix/smx_synchro.cpp b/src/simix/smx_synchro.cpp index 35b240f4de..2095a4c0b1 100644 --- a/src/simix/smx_synchro.cpp +++ b/src/simix/smx_synchro.cpp @@ -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: diff --git a/src/simix/smx_synchro_private.h b/src/simix/smx_synchro_private.h index c4c5371502..37b5f1339e 100644 --- a/src/simix/smx_synchro_private.h +++ b/src/simix/smx_synchro_private.h @@ -12,12 +12,12 @@ 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 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_); -- 2.20.1