X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/bded17ddf45f0643fd7f137d0acecdee853ea7d1..d6ba60ce19ac593de280c8dd791ee33d1df81bb9:/src/s4u/s4u_Actor.cpp diff --git a/src/s4u/s4u_Actor.cpp b/src/s4u/s4u_Actor.cpp index 10e25304e8..7a50472137 100644 --- a/src/s4u/s4u_Actor.cpp +++ b/src/s4u/s4u_Actor.cpp @@ -28,8 +28,9 @@ xbt::signal s4u::Actor::on_suspend; xbt::signal s4u::Actor::on_resume; xbt::signal s4u::Actor::on_sleep; xbt::signal s4u::Actor::on_wake_up; -xbt::signal s4u::Actor::on_migration_start; -xbt::signal s4u::Actor::on_migration_end; +xbt::signal s4u::Actor::on_migration_start; // deprecated +xbt::signal s4u::Actor::on_migration_end; // deprecated +xbt::signal s4u::Actor::on_host_change; xbt::signal s4u::Actor::on_termination; xbt::signal s4u::Actor::on_destruction; @@ -127,7 +128,17 @@ void Actor::on_exit(const std::function& fun) const void Actor::migrate(Host* new_host) { - s4u::Actor::on_migration_start(*this); + if (s4u::Actor::on_migration_start.get_slot_count() > 0) { // XBT_ATTRIB_DEPRECATED_v329 + static bool already_warned = false; + if (not already_warned) { + XBT_INFO("Please use s4u::Actor::on_host_change instead of s4u::Actor::on_migration_start. This will be removed " + "in v3.29"); + already_warned = true; + } + s4u::Actor::on_migration_start(*this); + } + + auto* previous_location = get_host(); kernel::actor::simcall([this, new_host]() { if (pimpl_->waiting_synchro != nullptr) { @@ -141,7 +152,17 @@ void Actor::migrate(Host* new_host) this->pimpl_->set_host(new_host); }); - s4u::Actor::on_migration_end(*this); + if (s4u::Actor::on_migration_end.get_slot_count() > 0) { // XBT_ATTRIB_DEPRECATED_v329 + static bool already_warned = false; + if (not already_warned) { + XBT_INFO("Please use s4u::Actor::on_host_change instead of s4u::Actor::on_migration_end. This will be removed in " + "v3.29"); + already_warned = true; + } + s4u::Actor::on_migration_end(*this); + } + + s4u::Actor::on_host_change(*this, *previous_location); } s4u::Host* Actor::get_host() const