X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/d58a00ab3206780f2a75e495e76613aa706f0ba4..c97656604936a7d3000ee3c98e0926b80f6f2150:/include/simgrid/s4u/Engine.hpp?ds=sidebyside diff --git a/include/simgrid/s4u/Engine.hpp b/include/simgrid/s4u/Engine.hpp index f62b955895..e2e0c863f4 100644 --- a/include/simgrid/s4u/Engine.hpp +++ b/include/simgrid/s4u/Engine.hpp @@ -25,6 +25,8 @@ namespace s4u { * This is a singleton containing all the main functions of the simulation. */ class XBT_PUBLIC Engine { + friend simgrid::kernel::EngineImpl; + public: /** Constructor, taking the command line parameters of your main function */ explicit Engine(int* argc, char** argv); @@ -57,21 +59,22 @@ public: XBT_ATTRIB_DEPRECATED_v330("Please change the return code of your actors to void") void register_default( int (*code)(int, char**)); void register_default(void (*code)(int, char**)); + void register_default(kernel::actor::ActorCodeFactory factory); + void register_function(const std::string& name, kernel::actor::ActorCodeFactory factory); template void register_actor(const std::string& name) { - simix::register_function(name, [](std::vector args) { - return simix::ActorCode([args] { + register_function(name, [](std::vector args) { + return kernel::actor::ActorCode([args] { F code(std::move(args)); code(); }); }); } - template void register_actor(const std::string& name, F code) { - simix::register_function(name, [code](std::vector args) { - return simix::ActorCode([code, args] { code(std::move(args)); }); + register_function(name, [code](std::vector args) { + return kernel::actor::ActorCode([code, args] { code(std::move(args)); }); }); }