Task scheduling =============== When the current executed task reaches a *task scheduling point*, the implementation may decide to switch from this task to another one from the set of eligible tasks. Task scheduling points may occur at the following locations: * In a task generating code. * In a taskwait directive. * Just after the completion of a task. * When entering or exiting a critical section. * When explicitly blocking or unblocking a task through the blocking API. The fact of switching from a task to a different one is known as *task switching* and it may imply to begin the execution of a non-previously executed task or to resume the execution of a partially executed task. Task switching is restricted in the following situations: * The set of eligible tasks (at a given time) is initially formed by the set of tasks included in the ready task pool (at this time). * Once a task has been executed by a given thread, it can be only resumed by the very same thread (i.e., the set of eligible tasks for a thread does not include tasks that have been previously executed by a different thread). * When creating a task with the ``if`` clause for which expression evaluated to false, the run-time system must offer a mechanism to immediately execute this task (usually by the same thread that creates it). * When executing in a ``final`` context all the encountered *task generating codes* will execute the task immediately after creating it as if it was a simple routine call (i.e., the set of eligible tasks in this situation is restricted to include only the newly generated task). .. note:: Remember that the *ready task pool* does not include tasks with dependences still not fulfilled (i.e., not all predecessors of a task have finished yet) or blocked tasks in any other condition (e.g., tasks executing a taskwait with non-finished child tasks).