CpuTiAction* action = static_cast<CpuTiAction*>(actionHeapPop());
XBT_DEBUG("Action %p: finish", action);
action->finish(kernel::resource::Action::State::done);
- /* set the remains to 0 due to precision problems when updating the remaining amount */
- action->set_remains(0);
/* update remaining amount of all actions */
action->cpu_->updateRemainingAmount(surf_get_clock());
}
{
cpu_->modified(true);
}
-
-void CpuTiAction::set_state(Action::State state)
+CpuTiAction::~CpuTiAction()
{
- CpuAction::set_state(state);
+ /* remove from action_set */
+ if (action_ti_hook.is_linked())
+ simgrid::xbt::intrusive_erase(cpu_->actionSet_, *this);
+ /* remove from heap */
+ heapRemove(get_model()->getActionHeap());
cpu_->modified(true);
}
-int CpuTiAction::unref()
+void CpuTiAction::set_state(Action::State state)
{
- refcount_--;
- if (not refcount_) {
- if (state_set_hook_.is_linked())
- simgrid::xbt::intrusive_erase(*get_state_set(), *this);
- /* remove from action_set */
- if (action_ti_hook.is_linked())
- simgrid::xbt::intrusive_erase(cpu_->actionSet_, *this);
- /* remove from heap */
- heapRemove(get_model()->getActionHeap());
- cpu_->modified(true);
- delete this;
- return 1;
- }
- return 0;
+ CpuAction::set_state(state);
+ cpu_->modified(true);
}
void CpuTiAction::cancel()