Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Move a function to the right file and other cleanups
[simgrid.git] / src / kernel / actor / ActorImpl.cpp
index c863647..6def798 100644 (file)
@@ -508,4 +508,22 @@ void create_maestro(const std::function<void()>& code)
   engine->set_maestro(maestro);
 }
 
+/** (in kernel mode) unpack the simcall and activate the handler */
+void ActorImpl::simcall_handle(int times_considered)
+{
+  XBT_DEBUG("Handling simcall %p: %s(%ld) %s", &simcall_, simcall_.issuer_->get_cname(), simcall_.issuer_->get_pid(),
+            (simcall_.observer_ != nullptr ? simcall_.observer_->to_string().c_str() : simcall_.get_cname()));
+  if (simcall_.observer_ != nullptr)
+    simcall_.observer_->prepare(times_considered);
+  if (wannadie())
+    return;
+
+  xbt_assert(simcall_.call_ != Simcall::Type::NONE, "Asked to do the noop syscall on %s@%s", get_cname(),
+             get_host()->get_cname());
+
+  (*simcall_.code_)();
+  if (simcall_.call_ == Simcall::Type::RUN_ANSWERED)
+    simcall_answer();
+}
+
 } // namespace simgrid::kernel::actor