From 87878ac201f73773310307d2283da58914901151 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Mon, 12 Apr 2021 22:38:58 +0200 Subject: [PATCH] More cosmetics around namespaces. --- src/kernel/activity/ActivityImpl.cpp | 12 +++---- src/kernel/activity/CommImpl.cpp | 31 +++++++++---------- src/kernel/activity/ConditionVariableImpl.cpp | 4 +-- src/kernel/activity/ExecImpl.cpp | 13 +++----- src/kernel/activity/IoImpl.cpp | 2 +- src/kernel/activity/MutexImpl.cpp | 2 +- 6 files changed, 30 insertions(+), 34 deletions(-) diff --git a/src/kernel/activity/ActivityImpl.cpp b/src/kernel/activity/ActivityImpl.cpp index b8b2eae219..c6c864b6f7 100644 --- a/src/kernel/activity/ActivityImpl.cpp +++ b/src/kernel/activity/ActivityImpl.cpp @@ -74,24 +74,24 @@ void ActivityImpl::wait_for(actor::ActorImpl* issuer, double timeout) if (MC_is_active() || MC_record_replay_is_active()) { int idx = issuer->simcall_.mc_value_; if (idx == 0) { - state_ = simgrid::kernel::activity::State::DONE; + state_ = State::DONE; } else { /* If we reached this point, the wait simcall must have a timeout */ /* Otherwise it shouldn't be enabled and executed by the MC */ if (timeout < 0.0) THROW_IMPOSSIBLE; - state_ = simgrid::kernel::activity::State::TIMEOUT; + state_ = State::TIMEOUT; } finish(); return; } /* If the synchro is already finished then perform the error handling */ - if (state_ != simgrid::kernel::activity::State::RUNNING) + if (state_ != State::RUNNING) finish(); else if (timeout == 0.) { // still running and timeout == 0 ? We need to report a timeout - state_ = simgrid::kernel::activity::State::TIMEOUT; + state_ = State::TIMEOUT; finish(); } else { /* we need a sleep action (even when the timeout is infinite) to be notified of host failures */ @@ -126,12 +126,12 @@ void ActivityImpl::cancel() } // boost::intrusive_ptr support: -void intrusive_ptr_add_ref(simgrid::kernel::activity::ActivityImpl* activity) +void intrusive_ptr_add_ref(ActivityImpl* activity) { activity->refcount_.fetch_add(1, std::memory_order_relaxed); } -void intrusive_ptr_release(simgrid::kernel::activity::ActivityImpl* activity) +void intrusive_ptr_release(ActivityImpl* activity) { if (activity->refcount_.fetch_sub(1, std::memory_order_release) == 1) { std::atomic_thread_fence(std::memory_order_acquire); diff --git a/src/kernel/activity/CommImpl.cpp b/src/kernel/activity/CommImpl.cpp index 1245a7b8b5..f61f3ec2d2 100644 --- a/src/kernel/activity/CommImpl.cpp +++ b/src/kernel/activity/CommImpl.cpp @@ -446,7 +446,7 @@ void CommImpl::wait_any_for(actor::ActorImpl* issuer, const std::vectorsimcalls_.push_back(&issuer->simcall_); simcall_comm_waitany__set__result(&issuer->simcall_, idx); - comm->state_ = simgrid::kernel::activity::State::DONE; + comm->state_ = State::DONE; comm->finish(); return; } @@ -454,7 +454,7 @@ void CommImpl::wait_any_for(actor::ActorImpl* issuer, const std::vectorsimcall_.timeout_cb_ = nullptr; } else { - issuer->simcall_.timeout_cb_ = simgrid::simix::Timer::set(SIMIX_get_clock() + timeout, [issuer, comms]() { + issuer->simcall_.timeout_cb_ = simix::Timer::set(SIMIX_get_clock() + timeout, [issuer, comms]() { // FIXME: Vector `comms' is copied here. Use a reference once its lifetime is extended (i.e. when the simcall is // modernized). issuer->simcall_.timeout_cb_ = nullptr; @@ -470,8 +470,7 @@ void CommImpl::wait_any_for(actor::ActorImpl* issuer, const std::vectorsimcalls_.push_back(&issuer->simcall_); /* see if the synchro is already finished */ - if (comm->state_ != simgrid::kernel::activity::State::WAITING && - comm->state_ != simgrid::kernel::activity::State::RUNNING) { + if (comm->state_ != State::WAITING && comm->state_ != State::RUNNING) { comm->finish(); break; } @@ -572,8 +571,8 @@ void CommImpl::finish() if (simcall->call_ == simix::Simcall::NONE) // FIXME: maybe a better way to handle this case continue; // if actor handling comm is killed if (simcall->call_ == simix::Simcall::COMM_WAITANY) { - simgrid::kernel::activity::CommImpl** comms = simcall_comm_waitany__get__comms(simcall); - size_t count = simcall_comm_waitany__get__count(simcall); + CommImpl** comms = simcall_comm_waitany__get__comms(simcall); + size_t count = simcall_comm_waitany__get__count(simcall); for (size_t i = 0; i < count; i++) comms[i]->unregister_simcall(simcall); if (simcall->timeout_cb_) { @@ -597,12 +596,12 @@ void CommImpl::finish() switch (state_) { case State::SRC_TIMEOUT: simcall->issuer_->exception_ = std::make_exception_ptr( - simgrid::TimeoutException(XBT_THROW_POINT, "Communication timeouted because of the sender")); + TimeoutException(XBT_THROW_POINT, "Communication timeouted because of the sender")); break; case State::DST_TIMEOUT: simcall->issuer_->exception_ = std::make_exception_ptr( - simgrid::TimeoutException(XBT_THROW_POINT, "Communication timeouted because of the receiver")); + TimeoutException(XBT_THROW_POINT, "Communication timeouted because of the receiver")); break; case State::SRC_HOST_FAILURE: @@ -610,7 +609,7 @@ void CommImpl::finish() simcall->issuer_->context_->set_wannadie(); else simcall->issuer_->exception_ = - std::make_exception_ptr(simgrid::NetworkFailureException(XBT_THROW_POINT, "Remote peer failed")); + std::make_exception_ptr(NetworkFailureException(XBT_THROW_POINT, "Remote peer failed")); break; case State::DST_HOST_FAILURE: @@ -618,7 +617,7 @@ void CommImpl::finish() simcall->issuer_->context_->set_wannadie(); else simcall->issuer_->exception_ = - std::make_exception_ptr(simgrid::NetworkFailureException(XBT_THROW_POINT, "Remote peer failed")); + std::make_exception_ptr(NetworkFailureException(XBT_THROW_POINT, "Remote peer failed")); break; case State::LINK_FAILURE: @@ -635,16 +634,16 @@ void CommImpl::finish() XBT_DEBUG("I'm neither source nor dest"); } simcall->issuer_->throw_exception( - std::make_exception_ptr(simgrid::NetworkFailureException(XBT_THROW_POINT, "Link failure"))); + std::make_exception_ptr(NetworkFailureException(XBT_THROW_POINT, "Link failure"))); break; case State::CANCELED: if (simcall->issuer_ == dst_actor_) - simcall->issuer_->exception_ = std::make_exception_ptr( - simgrid::CancelException(XBT_THROW_POINT, "Communication canceled by the sender")); + simcall->issuer_->exception_ = + std::make_exception_ptr(CancelException(XBT_THROW_POINT, "Communication canceled by the sender")); else - simcall->issuer_->exception_ = std::make_exception_ptr( - simgrid::CancelException(XBT_THROW_POINT, "Communication canceled by the receiver")); + simcall->issuer_->exception_ = + std::make_exception_ptr(CancelException(XBT_THROW_POINT, "Communication canceled by the receiver")); break; default: @@ -672,7 +671,7 @@ void CommImpl::finish() // In order to modify the exception we have to rethrow it: try { std::rethrow_exception(simcall->issuer_->exception_); - } catch (simgrid::Exception& e) { + } catch (Exception& e) { e.set_value(rank); } } diff --git a/src/kernel/activity/ConditionVariableImpl.cpp b/src/kernel/activity/ConditionVariableImpl.cpp index 4473de69f0..037e722104 100644 --- a/src/kernel/activity/ConditionVariableImpl.cpp +++ b/src/kernel/activity/ConditionVariableImpl.cpp @@ -87,12 +87,12 @@ void ConditionVariableImpl::wait(smx_mutex_t mutex, double timeout, actor::Actor } // boost::intrusive_ptr support: -void intrusive_ptr_add_ref(simgrid::kernel::activity::ConditionVariableImpl* cond) +void intrusive_ptr_add_ref(ConditionVariableImpl* cond) { cond->refcount_.fetch_add(1, std::memory_order_relaxed); } -void intrusive_ptr_release(simgrid::kernel::activity::ConditionVariableImpl* cond) +void intrusive_ptr_release(ConditionVariableImpl* cond) { if (cond->refcount_.fetch_sub(1, std::memory_order_release) == 1) { std::atomic_thread_fence(std::memory_order_acquire); diff --git a/src/kernel/activity/ExecImpl.cpp b/src/kernel/activity/ExecImpl.cpp index eb8b3b6b63..9810d0d3e3 100644 --- a/src/kernel/activity/ExecImpl.cpp +++ b/src/kernel/activity/ExecImpl.cpp @@ -189,18 +189,16 @@ void ExecImpl::finish() case State::FAILED: simcall->issuer_->context_->set_wannadie(); if (simcall->issuer_->get_host()->is_on()) - simcall->issuer_->exception_ = - std::make_exception_ptr(simgrid::HostFailureException(XBT_THROW_POINT, "Host failed")); + simcall->issuer_->exception_ = std::make_exception_ptr(HostFailureException(XBT_THROW_POINT, "Host failed")); /* else, the actor will be killed with no possibility to survive */ break; case State::CANCELED: - simcall->issuer_->exception_ = - std::make_exception_ptr(simgrid::CancelException(XBT_THROW_POINT, "Execution Canceled")); + simcall->issuer_->exception_ = std::make_exception_ptr(CancelException(XBT_THROW_POINT, "Execution Canceled")); break; case State::TIMEOUT: - simcall->issuer_->exception_ = std::make_exception_ptr(simgrid::TimeoutException(XBT_THROW_POINT, "Timeouted")); + simcall->issuer_->exception_ = std::make_exception_ptr(TimeoutException(XBT_THROW_POINT, "Timeouted")); break; default: @@ -242,7 +240,7 @@ void ExecImpl::wait_any_for(actor::ActorImpl* issuer, const std::vectorsimcall_.timeout_cb_ = nullptr; } else { - issuer->simcall_.timeout_cb_ = simgrid::simix::Timer::set(SIMIX_get_clock() + timeout, [issuer, &execs]() { + issuer->simcall_.timeout_cb_ = simix::Timer::set(SIMIX_get_clock() + timeout, [issuer, &execs]() { issuer->simcall_.timeout_cb_ = nullptr; for (auto* exec : execs) exec->unregister_simcall(&issuer->simcall_); @@ -256,8 +254,7 @@ void ExecImpl::wait_any_for(actor::ActorImpl* issuer, const std::vectorsimcalls_.push_back(&issuer->simcall_); /* see if the synchro is already finished */ - if (exec->state_ != simgrid::kernel::activity::State::WAITING && - exec->state_ != simgrid::kernel::activity::State::RUNNING) { + if (exec->state_ != State::WAITING && exec->state_ != State::RUNNING) { exec->finish(); break; } diff --git a/src/kernel/activity/IoImpl.cpp b/src/kernel/activity/IoImpl.cpp index c7bc45794e..527aa19a2a 100644 --- a/src/kernel/activity/IoImpl.cpp +++ b/src/kernel/activity/IoImpl.cpp @@ -106,7 +106,7 @@ void IoImpl::finish() simcall->issuer_->exception_ = std::make_exception_ptr(CancelException(XBT_THROW_POINT, "I/O Canceled")); break; case State::TIMEOUT: - simcall->issuer_->exception_ = std::make_exception_ptr(simgrid::TimeoutException(XBT_THROW_POINT, "Timeouted")); + simcall->issuer_->exception_ = std::make_exception_ptr(TimeoutException(XBT_THROW_POINT, "Timeouted")); break; default: xbt_assert(state_ == State::DONE, "Internal error in IoImpl::finish(): unexpected synchro state %s", diff --git a/src/kernel/activity/MutexImpl.cpp b/src/kernel/activity/MutexImpl.cpp index 2715bfb69a..fddb9e2456 100644 --- a/src/kernel/activity/MutexImpl.cpp +++ b/src/kernel/activity/MutexImpl.cpp @@ -10,7 +10,7 @@ #include "simgrid/modelchecker.h" #include "src/mc/mc_safety.hpp" #define MC_CHECK_NO_DPOR() \ - xbt_assert(not MC_is_active() || simgrid::mc::reduction_mode != simgrid::mc::ReductionMode::dpor, \ + xbt_assert(not MC_is_active() || mc::reduction_mode != mc::ReductionMode::dpor, \ "Mutex is currently not supported with DPOR, use --cfg=model-check/reduction:none") #else #define MC_CHECK_NO_DPOR() (void)0 -- 2.20.1