Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Avoid unnecessary copy of parameters for parallel_execute.
[simgrid.git] / include / simgrid / s4u / Actor.hpp
index 06ef8a2..3b1cffa 100644 (file)
@@ -126,7 +126,7 @@ class XBT_PUBLIC Actor : public simgrid::xbt::Extendable<Actor> {
   friend simgrid::kernel::actor::ActorImpl;
   friend simgrid::kernel::activity::MailboxImpl;
 
-  kernel::actor::ActorImpl* pimpl_ = nullptr;
+  kernel::actor::ActorImpl* const pimpl_ = nullptr;
 
   explicit Actor(smx_actor_t pimpl) : pimpl_(pimpl) {}
 
@@ -258,9 +258,6 @@ public:
    */
   void kill();
 
-  /** Kill an actor from its ID */
-  static void kill(aid_t pid);
-
   /** Retrieves the actor that have the given PID (or nullptr if not existing) */
   static ActorPtr by_pid(aid_t pid);
 
@@ -279,7 +276,7 @@ public:
   void join(double timeout);
   Actor* restart();
 
-  /** Ask kindly to all actors to die. Only the issuer will survive. */
+  /** Kill all actors (but the issuer). Being killed is not something that actors can delay or avoid. */
   static void kill_all();
 
   /** Returns the internal implementation of this actor */
@@ -292,6 +289,8 @@ public:
   void set_property(std::string key, std::string value);
 
 #ifndef DOXYGEN
+  XBT_ATTRIB_DEPRECATED_v325("Please use Actor::by_pid(pid).kill() instead") static void kill(aid_t pid);
+
   /** @deprecated See Actor::create() */
   XBT_ATTRIB_DEPRECATED_v323("Please use Actor::create()") static ActorPtr createActor(
       const char* name, s4u::Host* host, std::function<void()> code)
@@ -470,22 +469,23 @@ XBT_PUBLIC void execute(double flop, double priority);
  *
  * \endrst
  */
-XBT_PUBLIC void parallel_execute(std::vector<s4u::Host*> hosts, std::vector<double> flops_amounts,
-                                 std::vector<double> bytes_amounts);
+XBT_PUBLIC void parallel_execute(const std::vector<s4u::Host*>& hosts, const std::vector<double>& flops_amounts,
+                                 const std::vector<double>& bytes_amounts);
 
 /** \rst
  * Block the current actor until the built :ref:`parallel execution <API_s4u_parallel_execute>` completes, or until the
  * timeout. \endrst
  */
-XBT_PUBLIC void parallel_execute(std::vector<s4u::Host*> hosts, std::vector<double> flops_amounts,
-                                 std::vector<double> bytes_amounts, double timeout);
+XBT_PUBLIC void parallel_execute(const std::vector<s4u::Host*>& hosts, const std::vector<double>& flops_amounts,
+                                 const std::vector<double>& bytes_amounts, double timeout);
 
 #ifndef DOXYGEN
 XBT_ATTRIB_DEPRECATED_v325("Please use std::vectors as parameters") XBT_PUBLIC
-    void parallel_execute(int host_nb, s4u::Host** host_list, double* flops_amount, double* bytes_amount);
+    void parallel_execute(int host_nb, s4u::Host* const* host_list, const double* flops_amount,
+                          const double* bytes_amount);
 XBT_ATTRIB_DEPRECATED_v325("Please use std::vectors as parameters") XBT_PUBLIC
-    void parallel_execute(int host_nb, s4u::Host** host_list, double* flops_amount, double* bytes_amount,
-                          double timeout);
+    void parallel_execute(int host_nb, s4u::Host* const* host_list, const double* flops_amount,
+                          const double* bytes_amount, double timeout);
 #endif
 
 XBT_PUBLIC ExecPtr exec_init(double flops_amounts);