X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/b92ccbf24de98e83153f96b440ec559fc739e295..9360876a023f718566cdf7074eebea597ff4f6aa:/src/simix/libsmx.cpp 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; }