X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/4e7df12e1e81b2ff9212175628873d6d880b6630..d6ba60ce19ac593de280c8dd791ee33d1df81bb9:/src/s4u/s4u_Actor.cpp diff --git a/src/s4u/s4u_Actor.cpp b/src/s4u/s4u_Actor.cpp index 80cd55af9b..7a50472137 100644 --- a/src/s4u/s4u_Actor.cpp +++ b/src/s4u/s4u_Actor.cpp @@ -18,7 +18,7 @@ #include #include -XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_actor, "S4U actors"); +XBT_LOG_NEW_DEFAULT_SUBCATEGORY(s4u_actor, s4u, "S4U actors"); namespace simgrid { namespace s4u { @@ -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 @@ -685,6 +706,16 @@ const char* sg_actor_self_get_name() return simgrid::s4u::this_actor::get_cname(); } +void* sg_actor_self_data() +{ + return simgrid::s4u::Actor::self()->get_data(); +} + +void sg_actor_self_data_set(void* userdata) +{ + simgrid::s4u::Actor::self()->set_data(userdata); +} + sg_actor_t sg_actor_self() { return simgrid::s4u::Actor::self(); @@ -707,7 +738,7 @@ void sg_actor_unref(sg_actor_t actor) } /** @brief Return the user data of a #sg_actor_t */ -void* sg_actor_data(sg_actor_t actor) +void* sg_actor_data(const_sg_actor_t actor) { return actor->get_data(); }