Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
added circle placement for ns3 wifi nodes
[simgrid.git] / src / s4u / s4u_Activity.cpp
index f1a24ae50d898ece2be473e51e5f788370732d50..18d27cf4c446d242240d69522757f6d53ec7aa01 100644 (file)
@@ -42,9 +42,35 @@ bool Activity::test()
   return false;
 }
 
+Activity* Activity::suspend()
+{
+  if (suspended_)
+    return this; // Already suspended
+  suspended_ = true;
+
+  if (state_ == State::STARTED)
+    pimpl_->suspend();
+
+  return this;
+}
+
+Activity* Activity::resume()
+{
+  if (not suspended_)
+    return this; // nothing to restore when it's not suspended
+
+  if (state_ == State::STARTED)
+    pimpl_->resume();
+
+  return this;
+}
+
 double Activity::get_remaining() const
 {
-  return remains_;
+  if (state_ == State::INITED || state_ == State::STARTING)
+    return remains_;
+  else
+    return pimpl_->get_remaining();
 }
 
 Activity* Activity::set_remaining(double remains)