X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/29d145c3e90c4d7a9dd744dae93e330b10724392..417ed3b671abe3a71fa4106d23d0a432084cc207:/include/simgrid/s4u/Actor.hpp diff --git a/include/simgrid/s4u/Actor.hpp b/include/simgrid/s4u/Actor.hpp index b5a2251eb2..acdcafe1c8 100644 --- a/include/simgrid/s4u/Actor.hpp +++ b/include/simgrid/s4u/Actor.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2006-2022. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2006-2023. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -11,7 +11,6 @@ #include #include #include -#include #include #include @@ -102,16 +101,16 @@ XBT_PUBLIC void execute(double flop, double priority); * * These objects are somewhat surprising from a modeling point of view. For example, the unit of their speed is * somewhere between flop/sec and byte/sec. Arbitrary parallel executions will simply not work with the usual platform - * models, and you must :ref:`use the ptask_L07 host model ` for that. Note that you can mix + * models, and you must :ref:`use the ptask_L07 host model ` for that. Note that you can mix * regular executions and communications with parallel executions, provided that the host model is ptask_L07. * * @endrst */ -/** Block the current actor until the built parallel execution completes */ +/** Block the current actor until the built parallel execution completes. */ XBT_PUBLIC void parallel_execute(const std::vector& hosts, const std::vector& flops_amounts, const std::vector& bytes_amounts); -/** Block the current actor until the built multi-thread execution completes */ +/** Block the current actor until the built multi-thread execution completes. */ XBT_PUBLIC void thread_execute(s4u::Host* host, double flop_amounts, int thread_count); /** Initialize a sequential execution that must then be started manually */ @@ -188,8 +187,8 @@ class XBT_PUBLIC Actor : public xbt::Extendable { friend Mailbox; friend kernel::actor::ActorImpl; friend kernel::activity::MailboxImpl; - friend void this_actor::sleep_for(double); - friend void this_actor::suspend(); + friend XBT_PUBLIC void this_actor::sleep_for(double); + friend XBT_PUBLIC void this_actor::suspend(); kernel::actor::ActorImpl* const pimpl_; #endif @@ -255,7 +254,7 @@ public: static void on_destruction_cb(const std::function& cb) { on_destruction.connect(cb); } /** Create an actor from a @c std::function. - * If the actor is restarted, it gets a fresh copy of the function. + * If the actor is restarted, it gets a fresh copy of the function. * @verbatim embed:rst:inline See the :ref:`example `. @endverbatim */ static ActorPtr create(const std::string& name, s4u::Host* host, const std::function& code); /** Create an actor, but don't start it yet. @@ -281,7 +280,7 @@ public: ActorPtr start(const std::function& code, std::vector args); - /** Create an actor from a callable thing. + /** Create an actor from a callable thing. * @verbatim embed:rst:inline See the :ref:`example `. @endverbatim */ template static ActorPtr create(const std::string& name, s4u::Host* host, F code) { @@ -290,7 +289,7 @@ public: /** Create an actor using a callable thing and its arguments. * - * Note that the arguments will be copied, so move-only parameters are forbidden. + * Note that the arguments will be copied, so move-only parameters are forbidden. * @verbatim embed:rst:inline See the :ref:`example `. @endverbatim */ template `. @endverbatim */ static ActorPtr create(const std::string& name, s4u::Host* host, const std::string& function, std::vector args); @@ -322,7 +321,7 @@ public: static bool is_maestro(); /** Retrieves the name of that actor as a C++ string */ - const simgrid::xbt::string& get_name() const; + const std::string& get_name() const; /** Retrieves the name of that actor as a C string */ const char* get_cname() const; /** Retrieves the host on which that actor is running */ @@ -332,7 +331,7 @@ public: /** Retrieves the actor ID of that actor's creator */ aid_t get_ppid() const; - /** Suspend an actor, that is blocked until resumeed by another actor */ + /** Suspend an actor, that is blocked until resumed by another actor. */ void suspend(); /** Resume an actor that was previously suspended */ @@ -341,10 +340,20 @@ public: /** Returns true if the actor is suspended. */ bool is_suspended() const; - /** If set to true, the actor will automatically restart when its host reboots */ + /** If set to true, the actor will automatically restart when its host reboots. + * + * Some elements of the actor are remembered over reboots: name, host, properties, the on_exit functions, whether it + * is daemonized and whether it should automatically restart when its host reboots. Note that the state after reboot + * is the one when set_auto_restart() is called. + * + * If you daemonize your actor after marking it auto_restart, then the new actor after rebooot will not be a daemon. + * + * The on_exit functions are the one defined when the actor dies, not the ones given when it was marked auto_restart + * (sorry for the inconsistency -- speak to us if it's too hard to bear). + */ Actor* set_auto_restart(bool autorestart = true); /** Returns the number of reboots that this actor did. Before the first reboot, this function returns 0. */ - int get_restart_count(); + int get_restart_count() const; /** Add a function to the list of "on_exit" functions for the current actor. The on_exit functions are the functions * executed when your actor is killed. You should use them to free the data used by your actor.