Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use references for callback parameters of on_exit().
[simgrid.git] / include / simgrid / s4u / Actor.hpp
index 2b85f6d..f3d91d1 100644 (file)
@@ -169,6 +169,8 @@ public:
    *  If the actor is restarted, the actor has a fresh copy of the function.
    */
   static ActorPtr create(std::string name, s4u::Host* host, std::function<void()> code);
+  static ActorPtr init(std::string name, s4u::Host* host);
+  ActorPtr start(std::function<void()> code);
 
   /** Create an actor from a std::function
    *
@@ -234,7 +236,7 @@ public:
    * It will be set to true if the actor was killed or failed because of an exception,
    * while it will remain to false if the actor terminated gracefully.
    */
-  void on_exit(std::function<void(bool /*failed*/)> fun);
+  void on_exit(const std::function<void(bool /*failed*/)>& fun);
 
   /** Sets the time at which that actor should be killed */
   void set_kill_time(double time);
@@ -293,8 +295,8 @@ public:
   void set_property(const std::string& key, std::string value);
 
 #ifndef DOXYGEN
-  XBT_ATTRIB_DEPRECATED_v325("Please use Actor::on_exit(fun) instead") void on_exit(std::function<void(int, void*)> fun,
-                                                                                    void* data);
+  XBT_ATTRIB_DEPRECATED_v325("Please use Actor::on_exit(fun) instead") void on_exit(
+      const std::function<void(int, void*)>& fun, void* data);
 
   XBT_ATTRIB_DEPRECATED_v325("Please use Actor::by_pid(pid).kill() instead") static void kill(aid_t pid);
 
@@ -496,6 +498,9 @@ XBT_ATTRIB_DEPRECATED_v325("Please use std::vectors as parameters") XBT_PUBLIC
 #endif
 
 XBT_PUBLIC ExecPtr exec_init(double flops_amounts);
+XBT_PUBLIC ExecPtr exec_init(const std::vector<s4u::Host*>& hosts, const std::vector<double>& flops_amounts,
+                             const std::vector<double>& bytes_amounts);
+
 XBT_PUBLIC ExecPtr exec_async(double flops_amounts);
 
 /** @brief Returns the actor ID of the current actor. */
@@ -538,7 +543,7 @@ XBT_PUBLIC void exit();
  * while it will remain to false if the actor terminated gracefully.
  */
 
-XBT_PUBLIC void on_exit(std::function<void(bool)> fun);
+XBT_PUBLIC void on_exit(const std::function<void(bool)>& fun);
 
 /** @brief Migrate the current actor to a new host. */
 XBT_PUBLIC void migrate(Host* new_host);
@@ -547,7 +552,7 @@ XBT_PUBLIC void migrate(Host* new_host);
 
 #ifndef DOXYGEN
 XBT_ATTRIB_DEPRECATED_v325("Please use std::function<void(bool)> for first parameter.") XBT_PUBLIC
-    void on_exit(std::function<void(int, void*)> fun, void* data);
+    void on_exit(const std::function<void(int, void*)>& fun, void* data);
 
 /** @deprecated Please use std::function<void(int, void*)> for first parameter */
 XBT_ATTRIB_DEPRECATED_v323("Please use std::function<void(bool)> for first parameter.") XBT_PUBLIC