X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/fb461c4d727a8bc0acb66a13d726149052849c62..b92ccbf24de98e83153f96b440ec559fc739e295:/src/simix/libsmx.cpp diff --git a/src/simix/libsmx.cpp b/src/simix/libsmx.cpp index 2c5473b32b..1a00a7365f 100644 --- a/src/simix/libsmx.cpp +++ b/src/simix/libsmx.cpp @@ -11,6 +11,7 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include "mc/mc.h" +#include "src/kernel/EngineImpl.hpp" #include "src/kernel/activity/CommImpl.hpp" #include "src/kernel/activity/ConditionVariableImpl.hpp" #include "src/kernel/activity/MutexImpl.hpp" @@ -19,13 +20,18 @@ #include "src/mc/mc_replay.hpp" #include "xbt/random.hpp" #include +#include -#include "popping_bodies.cpp" +#if SIMGRID_HAVE_MC +#include "src/mc/mc_forward.hpp" +#endif #include #include #include +XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix); + /** * @ingroup simix_comm_management */ @@ -220,17 +226,34 @@ bool simcall_comm_test(simgrid::kernel::activity::ActivityImpl* comm) // XBT_ATT return false; } +template static R simcall(simgrid::simix::Simcall call, T const&... t) +{ + auto self = simgrid::kernel::actor::ActorImpl::self(); + simgrid::simix::marshal(&self->simcall_, call, t...); + 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; - simcall_BODY_run_kernel(&code); + 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); 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; - simcall_BODY_run_blocking(&code); + 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); simgrid::kernel::actor::ActorImpl::self()->simcall_.observer_ = nullptr; }