- StorageAction *action = nullptr;
-
- ActionList *actionSet = getRunningActionSet();
- for(ActionList::iterator it(actionSet->begin()), itNext=it, itend(actionSet->end())
- ; it != itend ; it=itNext) {
- ++itNext;
- action = static_cast<StorageAction*>(&*it);
-
- if(action->m_type == WRITE)
- {
- // Update the disk usage
- // Update the file size
- // For each action of type write
- double current_progress =
- delta * lmm_variable_getvalue(action->getVariable());
- long int incr = current_progress;
-
- XBT_DEBUG("%s:\n\t progress = %.2f, current_progress = %.2f, "
- "incr = %ld, lrint(1) = %ld, lrint(2) = %ld",
- action->p_file->name,
- action->progress, current_progress, incr,
- lrint(action->progress + current_progress),
- lrint(action->progress)+ incr);
-
- /* take care of rounding error accumulation */
- if (lrint(action->progress + current_progress) >
- lrint(action->progress)+ incr)
- incr++;
-
- action->progress +=current_progress;
+ for (auto it = std::begin(*get_running_action_set()); it != std::end(*get_running_action_set());) {
+ StorageAction& action = static_cast<StorageAction&>(*it);
+ ++it; // increment iterator here since the following calls to action.finish() may invalidate it
+ action.update_remains(lrint(action.get_variable()->get_value() * delta));