be implicitly unpaused when we switch from 'running' to
'idle' state. Fix it by not switching to 'idle' when paused.
finished = true;
task->state = task_state_done;
} else {
- task->state = task_state_idle;
+ /* It might be paused */
+ if (task->state ==
+ task_state_running) {
+ task->state = task_state_idle;
+ }
}
done = true;
} else if (dispatch_count >= task->quantum) {
* so the minimum quantum is one.
*/
XTRACE("quantum");
- task->state = task_state_ready;
- requeue = true;
+ if (task->state == task_state_running) {
+ /*
+ * We requeue only if it's
+ * not paused.
+ */
+ task->state = task_state_ready;
+ requeue = true;
+ }
done = true;
}
} while (!done);