X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/08e94eb0482589e4b287cbea301b84daf52635bd..82567f27fa74ddc2b6afa8d9b682bdde15fe3f9c:/src/simix/ActorImpl.hpp diff --git a/src/simix/ActorImpl.hpp b/src/simix/ActorImpl.hpp index a0c178d4d0..785e25b280 100644 --- a/src/simix/ActorImpl.hpp +++ b/src/simix/ActorImpl.hpp @@ -13,6 +13,7 @@ #include #include #include +#include struct s_smx_process_exit_fun_t { std::function fun; @@ -59,7 +60,7 @@ public: bool has_to_auto_restart() { return auto_restart_; } void set_auto_restart(bool autorestart) { auto_restart_ = autorestart; } - context::Context* context_ = nullptr; /* the context (uctx/raw/thread) that executes the user function */ + std::unique_ptr context_; /* the context (uctx/raw/thread) that executes the user function */ std::exception_ptr exception_; bool finished_ = false; @@ -105,7 +106,10 @@ public: s4u::ActorPtr iface() { return s4u::ActorPtr(&piface_); } s4u::Actor* ciface() { return &piface_; } - static ActorImplPtr create(std::string name, simix::ActorCode code, void* data, s4u::Host* host, + ActorImplPtr init(std::string name, s4u::Host* host); + ActorImpl* start(const simix::ActorCode& code); + + static ActorImplPtr create(std::string name, const simix::ActorCode& code, void* data, s4u::Host* host, std::unordered_map* properties, ActorImpl* parent_actor); static ActorImplPtr attach(std::string name, void* data, s4u::Host* host, std::unordered_map* properties); @@ -139,10 +143,11 @@ public: bool daemon_ = false; ProcessArg() = default; - explicit ProcessArg(std::string name, std::function code, void* data, s4u::Host* host, double kill_time, - std::shared_ptr> properties, bool auto_restart) + explicit ProcessArg(std::string name, const std::function& code, void* data, s4u::Host* host, + double kill_time, std::shared_ptr> properties, + bool auto_restart) : name(name) - , code(std::move(code)) + , code(code) , data(data) , host(host) , kill_time(kill_time) @@ -153,7 +158,7 @@ public: explicit ProcessArg(s4u::Host* host, ActorImpl* actor) : name(actor->get_name()) - , code(std::move(actor->code)) + , code(actor->code) , data(actor->get_user_data()) , host(host) , kill_time(actor->get_kill_time()) @@ -169,7 +174,7 @@ typedef boost::intrusive::list> SynchroList; -XBT_PUBLIC void create_maestro(std::function code); +XBT_PUBLIC void create_maestro(const std::function& code); } // namespace actor } // namespace kernel } // namespace simgrid