Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
check that disk has been given as argument before accessing its pimpl
[simgrid.git] / src / s4u / s4u_Actor.cpp
index 372470b..e4ec4be 100644 (file)
@@ -108,20 +108,21 @@ void Actor::join() const
 
 void Actor::join(double timeout) const
 {
-  xbt_assert(not(MC_is_active() || MC_record_replay_is_active()),
-             "Actor::join() is not usable in MC yet. Please report this bug.");
-
   kernel::actor::ActorImpl* issuer = kernel::actor::ActorImpl::self();
   const kernel::actor::ActorImpl* target = pimpl_;
-  kernel::actor::simcall_blocking([issuer, target, timeout] {
-    if (target->wannadie()) {
-      // The joined actor is already finished, just wake up the issuer right away
-      issuer->simcall_answer();
-    } else {
-      kernel::activity::ActivityImplPtr sync = issuer->join(target, timeout);
-      sync->register_simcall(&issuer->simcall_);
-    }
-  });
+  kernel::actor::ActorJoinSimcall observer{issuer, get_impl(), timeout};
+
+  kernel::actor::simcall_blocking(
+      [issuer, target, timeout] {
+        if (target->wannadie()) {
+          // The joined actor is already finished, just wake up the issuer right away
+          issuer->simcall_answer();
+        } else {
+          kernel::activity::ActivityImplPtr sync = issuer->join(target, timeout);
+          sync->register_simcall(&issuer->simcall_);
+        }
+      },
+      &observer);
 }
 
 Actor* Actor::set_auto_restart(bool autorestart)
@@ -588,8 +589,8 @@ xbt_dict_t sg_actor_get_properties(const_sg_actor_t actor)
   const std::unordered_map<std::string, std::string>* props = actor->get_properties();
   if (props == nullptr)
     return nullptr;
-  for (auto const& kv : *props) {
-    xbt_dict_set(as_dict, kv.first.c_str(), xbt_strdup(kv.second.c_str()));
+  for (auto const& [key, value] : *props) {
+    xbt_dict_set(as_dict, key.c_str(), xbt_strdup(value.c_str()));
   }
   return as_dict;
 }