From 8746d00bf12a24dc3ac953e9646c4f1b92b39a45 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Wed, 24 May 2023 02:02:02 +0200 Subject: [PATCH] Specialize the Activity on_veto, on_suspend and on_resume in AnyActivity to ease the matching --- ChangeLog | 2 + docs/source/Plugins.rst | 11 ++++ docs/source/app_s4u.rst | 26 +++++---- examples/cpp/dag-comm/s4u-dag-comm.cpp | 10 +++- examples/cpp/dag-comm/s4u-dag-comm.tesh | 12 ++-- examples/cpp/dag-io/s4u-dag-io.cpp | 10 +++- examples/cpp/dag-io/s4u-dag-io.tesh | 6 +- examples/cpp/dag-simple/s4u-dag-simple.cpp | 6 +- examples/cpp/dag-simple/s4u-dag-simple.tesh | 10 ++-- .../cpp/exec-dependent/s4u-exec-dependent.cpp | 3 +- include/simgrid/s4u/Activity.hpp | 55 ++++++++----------- include/simgrid/s4u/Comm.hpp | 5 +- include/simgrid/s4u/Exec.hpp | 5 +- include/simgrid/s4u/Io.hpp | 5 +- src/instr/instr_platform.cpp | 4 +- src/kernel/activity/ActivityImpl.cpp | 4 +- src/kernel/resource/VirtualMachineImpl.cpp | 4 +- src/s4u/s4u_Activity.cpp | 4 -- 18 files changed, 100 insertions(+), 82 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7e2ff0a63b..a90cc353f8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -30,6 +30,8 @@ S4U: - Activity::on_resumed_cb() is renamed to Activity::on_resume_cb(), and fired right before the resume. - Resource::on_state_change_cb() is renamed to Resource::on_onoff_cb() to distinguish from the Activity::on_state_change_cb() that is related to the activity state machine, not on/off. + - Activity signals (veto, suspend, resume, completion) are now specialized by activity class. + That is, callbacks registered in Exec::on_suspend_cb will not be fired for Comms nor Ios. New S4U plugins: - Operation: They are designed to represent workflows, i.e, graphs of repeatable Activities. diff --git a/docs/source/Plugins.rst b/docs/source/Plugins.rst index bbba377bcc..bee80bc53a 100644 --- a/docs/source/Plugins.rst +++ b/docs/source/Plugins.rst @@ -135,12 +135,23 @@ Partial list of existing signals in s4u: - :cpp:func:`Comm::on_send ` :cpp:func:`Comm::on_recv ` :cpp:func:`Comm::on_completion ` + :cpp:func:`Comm::on_suspend ` + :cpp:func:`Comm::on_resume ` + :cpp:func:`Comm::on_veto ` - :cpp:func:`CommImpl::on_start ` :cpp:func:`CommImpl::on_completion ` - :cpp:func:`Exec::on_start ` :cpp:func:`Exec::on_completion ` + :cpp:func:`Exec::on_completion ` + :cpp:func:`Exec::on_suspend ` + :cpp:func:`Exec::on_resume ` + :cpp:func:`Exec::on_veto ` - :cpp:func:`Io::on_start ` :cpp:func:`Io::on_completion ` + :cpp:func:`Io::on_completion ` + :cpp:func:`Io::on_suspend ` + :cpp:func:`Io::on_resume ` + :cpp:func:`Io::on_veto ` Existing Plugins **************** diff --git a/docs/source/app_s4u.rst b/docs/source/app_s4u.rst index a9f6507eb1..34045cb43f 100644 --- a/docs/source/app_s4u.rst +++ b/docs/source/app_s4u.rst @@ -2150,17 +2150,6 @@ Suspending and resuming an activity .. doxygenfunction:: simgrid::s4u::Activity::resume .. doxygenfunction:: simgrid::s4u::Activity::is_suspended -Signals -------- - -.. tabs:: - - .. group-tab:: C++ - - .. doxygenfunction:: simgrid::s4u::Activity::on_completion_cb - .. doxygenfunction:: simgrid::s4u::Activity::on_suspended_cb - .. doxygenfunction:: simgrid::s4u::Activity::on_resumed_cb - .. _API_s4u_Comm: ============= @@ -2325,6 +2314,11 @@ Signals .. doxygenfunction:: simgrid::s4u::Comm::on_recv_cb .. doxygenfunction:: simgrid::s4u::Comm::on_send_cb + .. doxygenfunction:: simgrid::s4u::Comm::on_completion_cb + .. doxygenfunction:: simgrid::s4u::Comm::on_suspended_cb + .. doxygenfunction:: simgrid::s4u::Comm::on_resumed_cb + .. doxygenfunction:: simgrid::s4u::Comm::on_veto_cb + .. _API_s4u_Exec: ============= @@ -2461,6 +2455,11 @@ Signals .. doxygenfunction:: simgrid::s4u::Exec::on_start_cb .. doxygenfunction:: simgrid::s4u::Exec::on_completion_cb + .. doxygenfunction:: simgrid::s4u::Exec::on_completion_cb + .. doxygenfunction:: simgrid::s4u::Exec::on_suspended_cb + .. doxygenfunction:: simgrid::s4u::Exec::on_resumed_cb + .. doxygenfunction:: simgrid::s4u::Exec::on_veto_cb + .. _API_s4u_Io: =========== @@ -2532,6 +2531,11 @@ Signals .. doxygenfunction:: simgrid::s4u::Io::on_start_cb .. doxygenfunction:: simgrid::s4u::Io::on_completion_cb + .. doxygenfunction:: simgrid::s4u::Io::on_completion_cb + .. doxygenfunction:: simgrid::s4u::Io::on_suspended_cb + .. doxygenfunction:: simgrid::s4u::Io::on_resumed_cb + .. doxygenfunction:: simgrid::s4u::Io::on_veto_cb + .. _API_s4u_Synchronizations: ======================= diff --git a/examples/cpp/dag-comm/s4u-dag-comm.cpp b/examples/cpp/dag-comm/s4u-dag-comm.cpp index 2263b55471..690f3f06d1 100644 --- a/examples/cpp/dag-comm/s4u-dag-comm.cpp +++ b/examples/cpp/dag-comm/s4u-dag-comm.cpp @@ -20,9 +20,13 @@ int main(int argc, char* argv[]) auto jupiter = e.host_by_name("Jupiter"); // Display the details on vetoed activities - sg4::Activity::on_veto_cb([](const sg4::Activity& a) { - XBT_INFO("Activity '%s' vetoed. Dependencies: %s; Ressources: %s", a.get_cname(), - (a.dependencies_solved() ? "solved" : "NOT solved"), (a.is_assigned() ? "assigned" : "NOT assigned")); + sg4::Exec::on_veto_cb([](sg4::Exec const& exec) { + XBT_INFO("Execution '%s' vetoed. Dependencies: %s; Ressources: %s", exec.get_cname(), + (exec.dependencies_solved() ? "solved" : "NOT solved"), (exec.is_assigned() ? "assigned" : "NOT assigned")); + }); + sg4::Comm::on_veto_cb([](sg4::Comm const& comm) { + XBT_INFO("Communication '%s' vetoed. Dependencies: %s; Ressources: %s", comm.get_cname(), + (comm.dependencies_solved() ? "solved" : "NOT solved"), (comm.is_assigned() ? "assigned" : "NOT assigned")); }); sg4::Exec::on_completion_cb([](sg4::Exec const& exec) { diff --git a/examples/cpp/dag-comm/s4u-dag-comm.tesh b/examples/cpp/dag-comm/s4u-dag-comm.tesh index 512c1109d0..0024dd2016 100644 --- a/examples/cpp/dag-comm/s4u-dag-comm.tesh +++ b/examples/cpp/dag-comm/s4u-dag-comm.tesh @@ -1,13 +1,13 @@ #!/usr/bin/env tesh $ ${bindir:=.}/s4u-dag-comm ${platfdir}/two_hosts.xml --log=s4u_activity.t:verbose "--log=root.fmt:[%10.6r]%e(%i:%a@%h)%e%m%n" -> [ 0.000000] (0:maestro@) Activity 'parent' vetoed. Dependencies: solved; Ressources: NOT assigned -> [ 0.000000] (0:maestro@) Activity 'transfer' vetoed. Dependencies: NOT solved; Ressources: NOT assigned -> [ 0.000000] (0:maestro@) Activity 'child' vetoed. Dependencies: NOT solved; Ressources: NOT assigned +> [ 0.000000] (0:maestro@) Execution 'parent' vetoed. Dependencies: solved; Ressources: NOT assigned +> [ 0.000000] (0:maestro@) Communication 'transfer' vetoed. Dependencies: NOT solved; Ressources: NOT assigned +> [ 0.000000] (0:maestro@) Execution 'child' vetoed. Dependencies: NOT solved; Ressources: NOT assigned > [ 0.000000] (0:maestro@) 'parent' is assigned to a resource and all dependencies are solved. Let's start -> [ 0.000000] (0:maestro@) Activity 'transfer' vetoed. Dependencies: NOT solved; Ressources: NOT assigned -> [ 0.000000] (0:maestro@) Activity 'child' vetoed. Dependencies: NOT solved; Ressources: assigned -> [ 0.000000] (0:maestro@) Activity 'transfer' vetoed. Dependencies: NOT solved; Ressources: assigned +> [ 0.000000] (0:maestro@) Communication 'transfer' vetoed. Dependencies: NOT solved; Ressources: NOT assigned +> [ 0.000000] (0:maestro@) Execution 'child' vetoed. Dependencies: NOT solved; Ressources: assigned +> [ 0.000000] (0:maestro@) Communication 'transfer' vetoed. Dependencies: NOT solved; Ressources: assigned > [ 1.000000] (0:maestro@) Exec 'parent' is complete (start time: 0.000000, finish time: 1.000000) > [ 1.000000] (0:maestro@) Remove a dependency from 'parent' on 'transfer' > [ 1.000000] (0:maestro@) 'transfer' is assigned to a resource and all dependencies are solved. Let's start diff --git a/examples/cpp/dag-io/s4u-dag-io.cpp b/examples/cpp/dag-io/s4u-dag-io.cpp index 7ac9b55c63..e86e3a8e52 100644 --- a/examples/cpp/dag-io/s4u-dag-io.cpp +++ b/examples/cpp/dag-io/s4u-dag-io.cpp @@ -20,9 +20,13 @@ int main(int argc, char* argv[]) auto carl = e.host_by_name("carl"); // Display the details on vetoed activities - sg4::Activity::on_veto_cb([](const sg4::Activity& a) { - XBT_INFO("Activity '%s' vetoed. Dependencies: %s; Ressources: %s", a.get_cname(), - (a.dependencies_solved() ? "solved" : "NOT solved"), (a.is_assigned() ? "assigned" : "NOT assigned")); + sg4::Exec::on_veto_cb([](sg4::Exec const& exec) { + XBT_INFO("Exec '%s' vetoed. Dependencies: %s; Ressources: %s", exec.get_cname(), + (exec.dependencies_solved() ? "solved" : "NOT solved"), (exec.is_assigned() ? "assigned" : "NOT assigned")); + }); + sg4::Io::on_veto_cb([](sg4::Io const& io) { + XBT_INFO("Io '%s' vetoed. Dependencies: %s; Ressources: %s", io.get_cname(), + (io.dependencies_solved() ? "solved" : "NOT solved"), (io.is_assigned() ? "assigned" : "NOT assigned")); }); sg4::Exec::on_completion_cb([](sg4::Exec const& exec) { diff --git a/examples/cpp/dag-io/s4u-dag-io.tesh b/examples/cpp/dag-io/s4u-dag-io.tesh index d067ae0583..8c1c3ca51c 100644 --- a/examples/cpp/dag-io/s4u-dag-io.tesh +++ b/examples/cpp/dag-io/s4u-dag-io.tesh @@ -2,9 +2,9 @@ $ ${bindir:=.}/s4u-dag-io ${platfdir}/hosts_with_disks.xml --log=s4u_activity.t:verbose "--log=root.fmt:[%10.6r]%e(%i:%a@%h)%e%m%n" > [ 0.000000] (0:maestro@) 'parent' is assigned to a resource and all dependencies are solved. Let's start -> [ 0.000000] (0:maestro@) Activity 'write' vetoed. Dependencies: NOT solved; Ressources: assigned -> [ 0.000000] (0:maestro@) Activity 'read' vetoed. Dependencies: NOT solved; Ressources: assigned -> [ 0.000000] (0:maestro@) Activity 'child' vetoed. Dependencies: NOT solved; Ressources: assigned +> [ 0.000000] (0:maestro@) Io 'write' vetoed. Dependencies: NOT solved; Ressources: assigned +> [ 0.000000] (0:maestro@) Io 'read' vetoed. Dependencies: NOT solved; Ressources: assigned +> [ 0.000000] (0:maestro@) Exec 'child' vetoed. Dependencies: NOT solved; Ressources: assigned > [ 1.000000] (0:maestro@) Exec 'parent' is complete (start time: 0.000000, finish time: 1.000000) > [ 1.000000] (0:maestro@) Remove a dependency from 'parent' on 'write' > [ 1.000000] (0:maestro@) 'write' is assigned to a resource and all dependencies are solved. Let's start diff --git a/examples/cpp/dag-simple/s4u-dag-simple.cpp b/examples/cpp/dag-simple/s4u-dag-simple.cpp index c0c2a3e940..81797292c4 100644 --- a/examples/cpp/dag-simple/s4u-dag-simple.cpp +++ b/examples/cpp/dag-simple/s4u-dag-simple.cpp @@ -19,16 +19,16 @@ int main(int argc, char* argv[]) auto fafard = e.host_by_name("Fafard"); // Display the details on vetoed activities - sg4::Activity::on_veto_cb([](const sg4::Activity& a) { + sg4::Exec::on_veto_cb([](sg4::Exec const& a) { const auto& exec = static_cast(a); // all activities are execs in this example - XBT_INFO("Activity '%s' vetoed. Dependencies: %s; Ressources: %s", exec.get_cname(), + XBT_INFO("Execution '%s' vetoed. Dependencies: %s; Ressources: %s", exec.get_cname(), (exec.dependencies_solved() ? "solved" : "NOT solved"), (exec.is_assigned() ? "assigned" : "NOT assigned")); }); sg4::Exec::on_completion_cb([](sg4::Exec const& exec) { - XBT_INFO("Activity '%s' is complete (start time: %f, finish time: %f)", exec.get_cname(), exec.get_start_time(), + XBT_INFO("Execution '%s' is complete (start time: %f, finish time: %f)", exec.get_cname(), exec.get_start_time(), exec.get_finish_time()); }); diff --git a/examples/cpp/dag-simple/s4u-dag-simple.tesh b/examples/cpp/dag-simple/s4u-dag-simple.tesh index e41d10ee99..18b0d0b43a 100644 --- a/examples/cpp/dag-simple/s4u-dag-simple.tesh +++ b/examples/cpp/dag-simple/s4u-dag-simple.tesh @@ -3,14 +3,14 @@ $ ${bindir:=.}/s4u-dag-simple ${platfdir}/small_platform.xml --log=s4u_activity.t:verbose "--log=root.fmt:[%10.6r]%e(%i:%a@%h)%e%m%n" > [ 0.000000] (0:maestro@) 'parent 1' is assigned to a resource and all dependencies are solved. Let's start > [ 0.000000] (0:maestro@) 'parent 2' is assigned to a resource and all dependencies are solved. Let's start -> [ 0.000000] (0:maestro@) Activity 'child' vetoed. Dependencies: NOT solved; Ressources: NOT assigned -> [ 2.000000] (0:maestro@) Activity 'parent 1' is complete (start time: 0.000000, finish time: 2.000000) +> [ 0.000000] (0:maestro@) Execution 'child' vetoed. Dependencies: NOT solved; Ressources: NOT assigned +> [ 2.000000] (0:maestro@) Execution 'parent 1' is complete (start time: 0.000000, finish time: 2.000000) > [ 2.000000] (0:maestro@) Remove a dependency from 'parent 1' on 'child' > [ 2.000000] (0:maestro@) Activity child not ready. -> [ 3.000000] (0:maestro@) Activity 'parent 2' is complete (start time: 0.000000, finish time: 3.000000) +> [ 3.000000] (0:maestro@) Execution 'parent 2' is complete (start time: 0.000000, finish time: 3.000000) > [ 3.000000] (0:maestro@) Remove a dependency from 'parent 2' on 'child' -> [ 3.000000] (0:maestro@) Activity 'child' vetoed. Dependencies: solved; Ressources: NOT assigned +> [ 3.000000] (0:maestro@) Execution 'child' vetoed. Dependencies: solved; Ressources: NOT assigned > [ 3.000000] (0:maestro@) Activity child's dependencies are resolved. Let's assign it to Fafard. > [ 3.000000] (0:maestro@) 'child' is assigned to a resource and all dependencies are solved. Let's start -> [ 4.000000] (0:maestro@) Activity 'child' is complete (start time: 3.000000, finish time: 4.000000) +> [ 4.000000] (0:maestro@) Execution 'child' is complete (start time: 3.000000, finish time: 4.000000) > [ 4.000000] (0:maestro@) Simulation time 4 diff --git a/examples/cpp/exec-dependent/s4u-exec-dependent.cpp b/examples/cpp/exec-dependent/s4u-exec-dependent.cpp index a62cfd0f43..23e67b7555 100644 --- a/examples/cpp/exec-dependent/s4u-exec-dependent.cpp +++ b/examples/cpp/exec-dependent/s4u-exec-dependent.cpp @@ -54,8 +54,7 @@ int main(int argc, char* argv[]) sg4::Actor::create("worker", e.host_by_name("Fafard"), worker); - sg4::Activity::on_veto_cb([&e](sg4::Activity& a) { - auto& exec = static_cast(a); + sg4::Exec::on_veto_cb([&e](sg4::Exec& exec) { // First display the situation XBT_INFO("Activity '%s' vetoed. Dependencies: %s; Ressources: %s", exec.get_cname(), diff --git a/include/simgrid/s4u/Activity.hpp b/include/simgrid/s4u/Activity.hpp index ffd66d6238..0dade947b8 100644 --- a/include/simgrid/s4u/Activity.hpp +++ b/include/simgrid/s4u/Activity.hpp @@ -102,39 +102,12 @@ protected: * It is forbidden to change the amount of work once the Activity is started */ Activity* set_remaining(double remains); - virtual void fire_this_completion() const = 0; - -private: - static xbt::signal on_veto; - static xbt::signal on_suspend; - static xbt::signal on_resume; + virtual void fire_on_completion() const = 0; + virtual void fire_on_veto() const = 0; + virtual void fire_on_suspend() const = 0; + virtual void fire_on_resume() const = 0; public: - /*! Add a callback fired each time that the activity fails to start because of a veto (e.g., unsolved dependency or no - * resource assigned) */ - static void on_veto_cb(const std::function& cb) { on_veto.connect(cb); } - /*! Add a callback fired when the activity is suspended */ - static void on_suspend_cb(const std::function& cb) - { - on_suspend.connect(cb); - } - /*! Add a callback fired when the activity is resumed after being suspended */ - static void on_resume_cb(const std::function& cb) - { - on_resume.connect(cb); - } - - XBT_ATTRIB_DEPRECATED_v337("Please use on_suspend_cb() instead") static void on_suspended_cb( - const std::function& cb) - { - on_suspend.connect(cb); - } - XBT_ATTRIB_DEPRECATED_v337("Please use on_resume_cb() instead") static void on_resumed_cb( - const std::function& cb) - { - on_resume.connect(cb); - } - XBT_ATTRIB_DEPRECATED_v334("All start() are vetoable now. Please use start() ") void vetoable_start() { start(); @@ -148,7 +121,7 @@ public: } else { if (vetoed_activities_ != nullptr) vetoed_activities_->insert(this); - on_veto(*this); + fire_on_veto(); } } @@ -158,7 +131,7 @@ public: // released by the on_completion() callbacks. ActivityPtr keepalive(this); state_ = state; - fire_this_completion(); + fire_on_completion(); if (state == State::FINISHED) release_dependencies(); } @@ -258,10 +231,26 @@ template class Activity_T : public Activity { protected: inline static xbt::signal on_completion; + inline static xbt::signal on_veto; + inline static xbt::signal on_suspend; + inline static xbt::signal on_resume; public: /*! Add a callback fired when the activity completes (either normally, cancelled or failed) */ static void on_completion_cb(const std::function& cb) { on_completion.connect(cb); } + /*! Add a callback fired each time that the activity fails to start because of a veto (e.g., unsolved dependency or no + * resource assigned) */ + static void on_veto_cb(const std::function& cb) { on_veto.connect(cb); } + /*! Add a callback fired when the activity is suspended */ + static void on_suspend_cb(const std::function& cb) { on_suspend.connect(cb); } + /*! Add a callback fired when the activity is resumed after being suspended */ + static void on_resume_cb(const std::function& cb) { on_resume.connect(cb); } + + XBT_ATTRIB_DEPRECATED_v337("Please use on_suspend_cb() instead") static void on_suspended_cb( + const std::function& cb) { on_suspend.connect(cb); } + XBT_ATTRIB_DEPRECATED_v337("Please use on_resume_cb() instead") static void on_resumed_cb( + const std::function& cb) { on_resume.connect(cb); } + AnyActivity* add_successor(ActivityPtr a) { diff --git a/include/simgrid/s4u/Comm.hpp b/include/simgrid/s4u/Comm.hpp index 46f7b4e06c..1a3488c3dc 100644 --- a/include/simgrid/s4u/Comm.hpp +++ b/include/simgrid/s4u/Comm.hpp @@ -43,7 +43,10 @@ class XBT_PUBLIC Comm : public Activity_T { static xbt::signal on_start; protected: - void fire_this_completion() const override { on_completion(*this); } + void fire_on_completion() const override { on_completion(*this); } + void fire_on_veto() const override { on_veto(const_cast(*this)); } + void fire_on_suspend() const override { on_suspend(*this); } + void fire_on_resume() const override { on_resume(*this); } public: static void on_send_cb(const std::function& cb) { on_send.connect(cb); } diff --git a/include/simgrid/s4u/Exec.hpp b/include/simgrid/s4u/Exec.hpp index df0183fdb1..1f5d51919a 100644 --- a/include/simgrid/s4u/Exec.hpp +++ b/include/simgrid/s4u/Exec.hpp @@ -43,7 +43,10 @@ protected: void reset() const; static xbt::signal on_start; - void fire_this_completion() const override { on_completion(*this); } + void fire_on_completion() const override { on_completion(*this); } + void fire_on_veto() const override { on_veto(const_cast(*this)); } + void fire_on_suspend() const override { on_suspend(*this); } + void fire_on_resume() const override { on_resume(*this); } public: #ifndef DOXYGEN diff --git a/include/simgrid/s4u/Io.hpp b/include/simgrid/s4u/Io.hpp index fbab9a8007..ec3461201b 100644 --- a/include/simgrid/s4u/Io.hpp +++ b/include/simgrid/s4u/Io.hpp @@ -29,7 +29,10 @@ class XBT_PUBLIC Io : public Activity_T { protected: explicit Io(kernel::activity::IoImplPtr pimpl); Io* do_start() override; - void fire_this_completion() const override { on_completion(*this); } + void fire_on_completion() const override { on_completion(*this); } + void fire_on_veto() const override { on_veto(const_cast(*this)); } + void fire_on_suspend() const override { on_suspend(*this); } + void fire_on_resume() const override { on_resume(*this); } public: enum class OpType { READ, WRITE }; diff --git a/src/instr/instr_platform.cpp b/src/instr/instr_platform.cpp index ed817d3b07..540a8dddbd 100644 --- a/src/instr/instr_platform.cpp +++ b/src/instr/instr_platform.cpp @@ -479,8 +479,8 @@ void define_callbacks() s4u::Host::on_exec_state_change_cb(on_action_state_change); s4u::Link::on_communication_state_change_cb(on_action_state_change); - s4u::Activity::on_suspend_cb(on_activity_suspend_resume); - s4u::Activity::on_resume_cb(on_activity_suspend_resume); + s4u::Exec::on_suspend_cb(on_activity_suspend_resume); + s4u::Exec::on_resume_cb(on_activity_suspend_resume); if (TRACE_actor_is_enabled()) { s4u::Actor::on_creation_cb(on_actor_creation); diff --git a/src/kernel/activity/ActivityImpl.cpp b/src/kernel/activity/ActivityImpl.cpp index aaaba0692a..d1bafa941c 100644 --- a/src/kernel/activity/ActivityImpl.cpp +++ b/src/kernel/activity/ActivityImpl.cpp @@ -181,7 +181,7 @@ void ActivityImpl::suspend() return; } XBT_VERB("This activity is suspended (remain: %f)", model_action_->get_remains()); - s4u::Activity::on_suspend(*get_iface()); + get_iface()->fire_on_suspend(); model_action_->suspend(); } @@ -190,7 +190,7 @@ void ActivityImpl::resume() if (model_action_ == nullptr) return; XBT_VERB("This activity is resumed (remain: %f)", model_action_->get_remains()); - s4u::Activity::on_resume(*get_iface()); + get_iface()->fire_on_resume(); model_action_->resume(); } diff --git a/src/kernel/resource/VirtualMachineImpl.cpp b/src/kernel/resource/VirtualMachineImpl.cpp index 1e6337ba1d..b01f733c0b 100644 --- a/src/kernel/resource/VirtualMachineImpl.cpp +++ b/src/kernel/resource/VirtualMachineImpl.cpp @@ -123,8 +123,8 @@ VMModel::VMModel(const std::string& name) : HostModel(name) s4u::Host::on_onoff_cb(host_onoff); s4u::Exec::on_start_cb(add_active_exec); s4u::Exec::on_completion_cb(remove_active_exec); - s4u::Activity::on_resume_cb(add_active_activity); - s4u::Activity::on_suspend_cb(remove_active_activity); + s4u::Exec::on_resume_cb(add_active_activity); + s4u::Exec::on_suspend_cb(remove_active_activity); } double VMModel::next_occurring_event(double now) diff --git a/src/s4u/s4u_Activity.cpp b/src/s4u/s4u_Activity.cpp index 78768d3120..aa352f19cf 100644 --- a/src/s4u/s4u_Activity.cpp +++ b/src/s4u/s4u_Activity.cpp @@ -24,10 +24,6 @@ template class xbt::Extendable; namespace s4u { -xbt::signal Activity::on_veto; -xbt::signal Activity::on_suspend; -xbt::signal Activity::on_resume; - std::set* Activity::vetoed_activities_ = nullptr; void Activity::destroy() -- 2.20.1