From df0be021e84cc3e41020af8f1a5077d6737905c3 Mon Sep 17 00:00:00 2001 From: Frederic Suter Date: Thu, 28 Nov 2019 15:43:43 +0100 Subject: [PATCH] depreacate SIMIX_process_on_exit --- include/simgrid/simix.h | 3 ++- src/kernel/actor/ActorImpl.cpp | 5 +++-- src/s4u/s4u_Actor.cpp | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/include/simgrid/simix.h b/include/simgrid/simix.h index f9d074597f..8ffb312ae5 100644 --- a/include/simgrid/simix.h +++ b/include/simgrid/simix.h @@ -90,7 +90,8 @@ XBT_ATTRIB_DEPRECATED_v329("This function will be removed in 3.29") XBT_PUBLIC v SG_END_DECL #ifdef __cplusplus -XBT_PUBLIC void SIMIX_process_on_exit(smx_actor_t process, const std::function& fun); +XBT_ATTRIB_DEPRECATED_v329("This function will be removed in 3.29") XBT_PUBLIC + void SIMIX_process_on_exit(smx_actor_t process, const std::function& fun); #endif /****************************** Communication *********************************/ diff --git a/src/kernel/actor/ActorImpl.cpp b/src/kernel/actor/ActorImpl.cpp index 1db9c0dbaa..40c38f0848 100644 --- a/src/kernel/actor/ActorImpl.cpp +++ b/src/kernel/actor/ActorImpl.cpp @@ -389,7 +389,7 @@ void ActorImpl::resume() activity::ActivityImplPtr ActorImpl::join(ActorImpl* actor, double timeout) { activity::ActivityImplPtr sleep = this->sleep(timeout); - SIMIX_process_on_exit(actor, [sleep](bool) { + actor->on_exit->emplace_back([sleep](bool) { if (sleep->surf_action_) sleep->surf_action_->finish(resource::Action::State::FINISHED); }); @@ -579,7 +579,8 @@ smx_actor_t SIMIX_process_from_PID(aid_t PID) return item->second; } -void SIMIX_process_on_exit(smx_actor_t actor, const std::function& fun) +void SIMIX_process_on_exit(smx_actor_t actor, + const std::function& fun) // XBT_ATTRIB_DEPRECATED_v329 { xbt_assert(actor, "current process not found: are you in maestro context ?"); actor->on_exit->emplace_back(fun); diff --git a/src/s4u/s4u_Actor.cpp b/src/s4u/s4u_Actor.cpp index 2d2f2c631c..56e627912e 100644 --- a/src/s4u/s4u_Actor.cpp +++ b/src/s4u/s4u_Actor.cpp @@ -123,7 +123,7 @@ void Actor::set_auto_restart(bool autorestart) void Actor::on_exit(const std::function& fun) const { - kernel::actor::simcall([this, &fun] { SIMIX_process_on_exit(pimpl_, fun); }); + kernel::actor::simcall([this, &fun] { pimpl_->on_exit->emplace_back(fun); }); } void Actor::set_host(Host* new_host) -- 2.20.1