X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/a138d21077d565562a591d21260cc3937cacdba0..4b41294c49f838248cf4b8e6883ddd94dfdf72d9:/include/simgrid/s4u/Actor.hpp diff --git a/include/simgrid/s4u/Actor.hpp b/include/simgrid/s4u/Actor.hpp index 5b0378c21d..eef1611123 100644 --- a/include/simgrid/s4u/Actor.hpp +++ b/include/simgrid/s4u/Actor.hpp @@ -153,17 +153,9 @@ public: Actor(Actor const&) = delete; Actor& operator=(Actor const&) = delete; - // ***** Reference count (delegated to pimpl_) ***** - friend void intrusive_ptr_add_ref(Actor* actor) - { - xbt_assert(actor != nullptr); - SIMIX_process_ref(actor->pimpl_); - } - friend void intrusive_ptr_release(Actor* actor) - { - xbt_assert(actor != nullptr); - SIMIX_process_unref(actor->pimpl_); - } + // ***** Reference count ***** + friend void intrusive_ptr_add_ref(Actor * actor); + friend void intrusive_ptr_release(Actor * actor); // ***** Actor creation ***** /** Retrieve a reference to myself */ @@ -202,21 +194,23 @@ public: static ActorPtr createActor(const char* name, s4u::Host* host, const char* function, std::vector args); // ***** Methods ***** + /** This actor will be automatically terminated when the last non-daemon process finishes **/ + void daemonize(); /** Retrieves the name of that actor as a C string */ - const char* cname(); + const char* getCname(); /** Retrieves the name of that actor as a C++ string */ - simgrid::xbt::string name(); + simgrid::xbt::string getName(); /** Retrieves the host on which that actor is running */ - s4u::Host* host(); + s4u::Host* getHost(); /** Retrieves the PID of that actor * * actor_id_t is an alias for unsigned long */ - aid_t pid(); + aid_t getPid(); /** Retrieves the PPID of that actor * * actor_id_t is an alias for unsigned long */ - aid_t ppid(); + aid_t getPpid(); /** Suspend an actor by suspending the task on which it was waiting for the completion. */ void suspend(); @@ -238,7 +232,7 @@ public: /** Sets the time at which that actor should be killed */ void setKillTime(double time); /** Retrieves the time at which that actor will be killed (or -1 if not set) */ - double killTime(); + double getKillTime(); void migrate(Host * new_host); @@ -273,8 +267,9 @@ public: simix::ActorImpl* getImpl(); /** Retrieve the property value (or nullptr if not set) */ - const char* property(const char* key); + const char* getProperty(const char* key); void setProperty(const char* key, const char* value); + Actor* restart(); }; /** @ingroup s4u_api @@ -299,43 +294,54 @@ template inline void sleep_for(std::chrono::duration inline void sleep_for(std::chrono::duration