- duration = MAX(duration, sg_surf_precision);
-
- XBT_IN("(%s,%g)", getName(), duration);
- CpuCas01Action *action = new CpuCas01Action(getModel(), 1.0, isOff(),
- speed_.scale * speed_.peak, getConstraint());
-
- // FIXME: sleep variables should not consume 1.0 in lmm_expand
- action->m_maxDuration = duration;
- action->m_suspended = 2;
- if (duration == NO_MAX_DURATION) {
- /* Move to the *end* of the corresponding action set. This convention
- is used to speed up update_resource_state */
- action->getStateSet()->erase(action->getStateSet()->iterator_to(*action));
- action->p_stateSet = static_cast<CpuCas01Model*>(getModel())->p_cpuRunningActionSetThatDoesNotNeedBeingChecked;
+ duration = std::max(duration, sg_surf_precision);
+
+ XBT_IN("(%s,%g)", getCname(), duration);
+ CpuCas01Action* action = new CpuCas01Action(model(), 1.0, isOff(), speed_.scale * speed_.peak, constraint());
+
+ // FIXME: sleep variables should not consume 1.0 in System::expand()
+ action->setMaxDuration(duration);
+ action->suspended_ = Action::SuspendStates::sleeping;
+ if (duration < 0) { // NO_MAX_DURATION
+ /* Move to the *end* of the corresponding action set. This convention is used to speed up update_resource_state */
+ simgrid::xbt::intrusive_erase(*action->getStateSet(), *action);
+ action->stateSet_ = &static_cast<CpuCas01Model*>(model())->p_cpuRunningActionSetThatDoesNotNeedBeingChecked;