- xbt_assert(refcount_ > 0,
- "This activity has a negative refcount! You can only call test() or wait() once per activity.");
+ if (surf_action_ == nullptr)
+ return;
+ XBT_VERB("This activity is resumed (remain: %f)", surf_action_->get_remains());
+ surf_action_->resume();
+ on_resumed(*this);
+}
+
+void ActivityImpl::cancel()
+{
+ XBT_VERB("Activity %p is canceled", this);
+ if (surf_action_ != nullptr)
+ surf_action_->cancel();
+ state_ = SIMIX_CANCELED;
+}
+
+// boost::intrusive_ptr<Activity> support:
+void intrusive_ptr_add_ref(simgrid::kernel::activity::ActivityImpl* activity)
+{
+ activity->refcount_.fetch_add(1, std::memory_order_relaxed);
+}