From 9360876a023f718566cdf7074eebea597ff4f6aa Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Sun, 27 Feb 2022 18:03:44 +0100 Subject: [PATCH] simix simplification: no need for a template here --- src/simix/libsmx.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/simix/libsmx.cpp b/src/simix/libsmx.cpp index 1a00a7365f..e0629a1a3f 100644 --- a/src/simix/libsmx.cpp +++ b/src/simix/libsmx.cpp @@ -226,34 +226,33 @@ bool simcall_comm_test(simgrid::kernel::activity::ActivityImpl* comm) // XBT_ATT return false; } -template static R simcall(simgrid::simix::Simcall call, T const&... t) +static void simcall(simgrid::simix::Simcall call, std::function const& code) { auto self = simgrid::kernel::actor::ActorImpl::self(); - simgrid::simix::marshal(&self->simcall_, call, t...); + simgrid::simix::marshal(&self->simcall_, call, &code); if (not simgrid::kernel::EngineImpl::get_instance()->is_maestro(self)) { XBT_DEBUG("Yield process '%s' on simcall %s", self->get_cname(), SIMIX_simcall_name(self->simcall_)); self->yield(); } else { self->simcall_handle(0); } - return simgrid::simix::unmarshal(self->simcall_.result_); } void simcall_run_kernel(std::function const& code, simgrid::kernel::actor::SimcallObserver* observer) { simgrid::kernel::actor::ActorImpl::self()->simcall_.observer_ = observer; - if (false) /* Go to that function to follow the code flow through the simcall barrier */ - SIMIX_run_kernel(&code); - simcall const*>(simgrid::simix::Simcall::RUN_KERNEL, &code); + // The function `code` is called in kernel mode (either because we are already in maestor or after a context switch) + // and simcall_answer() is called + simcall(simgrid::simix::Simcall::RUN_KERNEL, code); simgrid::kernel::actor::ActorImpl::self()->simcall_.observer_ = nullptr; } void simcall_run_blocking(std::function const& code, simgrid::kernel::actor::SimcallObserver* observer) { simgrid::kernel::actor::ActorImpl::self()->simcall_.observer_ = observer; - if (false) /* Go to that function to follow the code flow through the simcall barrier */ - SIMIX_run_kernel(&code); - simcall const*>(simgrid::simix::Simcall::RUN_BLOCKING, &code); + // The function `code` is called in kernel mode (either because we are already in maestor or after a context switch) + // BUT simcall_answer IS NOT CALLED + simcall(simgrid::simix::Simcall::RUN_BLOCKING, code); simgrid::kernel::actor::ActorImpl::self()->simcall_.observer_ = nullptr; } -- 2.20.1