Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
factor cancel across activities
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 2 Apr 2019 15:09:17 +0000 (17:09 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 2 Apr 2019 15:09:17 +0000 (17:09 +0200)
* CommImpl is more complex
* RawImpl is a noop

src/kernel/activity/ActivityImpl.cpp
src/kernel/activity/ActivityImpl.hpp
src/kernel/activity/CommImpl.hpp
src/kernel/activity/ExecImpl.cpp
src/kernel/activity/ExecImpl.hpp
src/kernel/activity/IoImpl.cpp
src/kernel/activity/IoImpl.hpp
src/kernel/activity/SynchroRaw.cpp
src/kernel/activity/SynchroRaw.hpp

index 2065487..be0e1b0 100644 (file)
@@ -43,6 +43,13 @@ void ActivityImpl::resume()
   on_resumed(*this);
 }
 
+void ActivityImpl::cancel()
+{
+  XBT_VERB("Activity %p is canceled", this);
+  if (surf_action_ != nullptr)
+    surf_action_->cancel();
+}
+
 // boost::intrusive_ptr<Activity> support:
 void intrusive_ptr_add_ref(simgrid::kernel::activity::ActivityImpl* activity)
 {
index a81e6ac..1719af4 100644 (file)
@@ -31,6 +31,7 @@ public:
 
   virtual void suspend();
   virtual void resume();
+  virtual void cancel();
   virtual void post()   = 0; // What to do when a simcall terminates
   virtual void finish() = 0;
 
index 0339005..ca65fd0 100644 (file)
@@ -38,7 +38,7 @@ public:
   void resume() override;
   void post() override;
   void finish() override;
-  void cancel();
+  void cancel() override;
 
   CommImpl::Type type_;        /* Type of the communication (SIMIX_COMM_SEND or SIMIX_COMM_RECEIVE) */
   MailboxImpl* mbox = nullptr; /* Rendez-vous where the comm is queued */
index 476723f..c1b58d5 100644 (file)
@@ -124,13 +124,6 @@ ExecImpl* ExecImpl::start()
   return this;
 }
 
-void ExecImpl::cancel()
-{
-  XBT_VERB("This exec %p is canceled", this);
-  if (surf_action_ != nullptr)
-    surf_action_->cancel();
-}
-
 double ExecImpl::get_seq_remaining_ratio()
 {
   return (surf_action_ == nullptr) ? 0 : surf_action_->get_remains() / surf_action_->get_cost();
index 88b25eb..9e35d73 100644 (file)
@@ -42,7 +42,6 @@ public:
   virtual ActivityImpl* migrate(s4u::Host* to);
 
   ExecImpl* start();
-  void cancel();
   void post() override;
   void finish() override;
 
index 6adcc17..a35e926 100644 (file)
@@ -67,14 +67,6 @@ IoImpl* IoImpl::start()
   return this;
 }
 
-void IoImpl::cancel()
-{
-  XBT_VERB("This exec %p is canceled", this);
-  if (surf_action_ != nullptr)
-    surf_action_->cancel();
-  state_ = SIMIX_CANCELED;
-}
-
 void IoImpl::post()
 {
   performed_ioops_ = surf_action_->get_cost();
index fe74ccd..2ab4ff7 100644 (file)
@@ -30,7 +30,6 @@ public:
   IoImpl* start();
   void post() override;
   void finish() override;
-  void cancel();
 
   static xbt::signal<void(IoImpl const&)> on_start;
   static xbt::signal<void(IoImpl const&)> on_completion;
index 9f55eba..8d8ede0 100644 (file)
@@ -48,6 +48,12 @@ void RawImpl::resume()
   /* I cannot resume raw synchros directly. This is delayed to when the process is rescheduled at
    * the end of the synchro. */
 }
+
+void RawImpl::cancel()
+{
+  /* I cannot cancel raw synchros directly. */
+}
+
 void RawImpl::post()
 {
   if (surf_action_->get_state() == resource::Action::State::FAILED) {
index d11a996..13953ea 100644 (file)
@@ -25,6 +25,7 @@ public:
   RawImpl* start();
   void suspend() override;
   void resume() override;
+  void cancel() override;
   void post() override;
   void finish() override;
 };