Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
More cosmetics around namespaces.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 12 Apr 2021 20:38:58 +0000 (22:38 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 12 Apr 2021 20:38:58 +0000 (22:38 +0200)
src/kernel/activity/ActivityImpl.cpp
src/kernel/activity/CommImpl.cpp
src/kernel/activity/ConditionVariableImpl.cpp
src/kernel/activity/ExecImpl.cpp
src/kernel/activity/IoImpl.cpp
src/kernel/activity/MutexImpl.cpp

index b8b2eae..c6c864b 100644 (file)
@@ -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<Activity> 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);
index 1245a7b..f61f3ec 100644 (file)
@@ -446,7 +446,7 @@ void CommImpl::wait_any_for(actor::ActorImpl* issuer, const std::vector<CommImpl
     auto* comm = comms[idx];
     comm->simcalls_.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::vector<CommImpl
   if (timeout < 0.0) {
     issuer->simcall_.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::vector<CommImpl
     comm->simcalls_.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);
       }
     }
index 4473de6..037e722 100644 (file)
@@ -87,12 +87,12 @@ void ConditionVariableImpl::wait(smx_mutex_t mutex, double timeout, actor::Actor
 }
 
 // boost::intrusive_ptr<ConditionVariableImpl> 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);
index eb8b3b6..9810d0d 100644 (file)
@@ -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::vector<ExecImpl
   if (timeout < 0.0) {
     issuer->simcall_.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::vector<ExecImpl
     exec->simcalls_.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;
     }
index c7bc457..527aa19 100644 (file)
@@ -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",
index 2715bfb..fddb9e2 100644 (file)
@@ -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