-/* Copyright (c) 2006-2019. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2006-2020. 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. */
namespace simgrid {
namespace s4u {
-/** \beginrst An actor is an independent stream of execution in your distributed application.
+/** An actor is an independent stream of execution in your distributed application.
+ *
+ * \beginrst
* It is located on a (simulated) :cpp:class:`host <simgrid::s4u::Host>`, but can interact
* with the whole simulated platform.
*
Actor& operator=(Actor const&) = delete;
// ***** Reference count *****
- friend XBT_PUBLIC void intrusive_ptr_add_ref(Actor * actor);
- friend XBT_PUBLIC void intrusive_ptr_release(Actor * actor);
+ friend XBT_PUBLIC void intrusive_ptr_add_ref(const Actor* actor);
+ friend XBT_PUBLIC void intrusive_ptr_release(const Actor* actor);
#endif
/** Retrieve the amount of references on that object. Useful to debug the automatic refcounting */
int get_refcount();
static xbt::signal<void(Actor const&)> on_sleep;
/** Signal to others that an actor wakes up for a sleep **/
static xbt::signal<void(Actor const&)> on_wake_up;
- /** Signal to others that an actor is going to migrated to another host**/
- static xbt::signal<void(Actor const&)> on_migration_start;
/** Signal to others that an actor is has been migrated to another host **/
- static xbt::signal<void(Actor const&)> on_migration_end;
+ static xbt::signal<void(Actor const&, Host const& previous_location)> on_host_change;
+#ifndef DOXYGEN
+ static xbt::signal<void(Actor const&)> on_migration_start; // XBT_ATTRIB_DEPRECATED_v329
+ static xbt::signal<void(Actor const&)> on_migration_end; // XBT_ATTRIB_DEPRECATED_v329
+#endif
+
/** Signal indicating that an actor terminated its code.
* The actor may continue to exist if it is still referenced in the simulation, but it's not active anymore.
* If you want to free extra data when the actor's destructor is called, use Actor::on_destruction.
* Asynchronous activities started by the actor are not migrated automatically, so you have
* to take care of this yourself (only you knows which ones should be migrated).
*/
- void migrate(Host * new_host);
+ void set_host(Host* new_host);
+#ifndef DOXYGEN
+ XBT_ATTRIB_DEPRECATED_v329("Please use set_host() instead") void migrate(Host* new_host) { set_host(new_host); }
+#endif
/** Ask the actor to die.
*
*
* \endrst
*/
+/** Block the current actor until the built parallel execution completes */
XBT_PUBLIC void parallel_execute(const std::vector<s4u::Host*>& hosts, const std::vector<double>& flops_amounts,
const std::vector<double>& bytes_amounts);
-/** Block the current actor until the built parallel execution completes, or until the 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);
+XBT_ATTRIB_DEPRECATED_v329("Please use exec_init(...)->wait_for(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);
/** Initialize a sequential execution that must then be started manually */
XBT_PUBLIC ExecPtr exec_init(double flops_amounts);
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);
+XBT_PUBLIC void set_host(Host* new_host);
+#ifndef DOXYGEN
+XBT_ATTRIB_DEPRECATED_v329("Please use set_host() instead") XBT_PUBLIC void migrate(Host* new_host);
+#endif
/** @} */
}