The following routine causes the calling task to be delayed for the specified number of seconds. It also causes rescheduling so that other tasks may advance while this task is delayed.
Each task can request a time slice which is the maximal time period for which the task may hold the CPU without rescheduling another task. The request is made by calling the following routine:
To disable the time-slicing for some task, it should call this routine with a time slice of 0.0. This is also the default with which each task is initialized.
To disable and enable the time slicing mechanism for all the tasks, the following routines may be called:
Note that when time slicing is disabled, delays, timeouts and scheduled actions initialized by the scheduler (either before or after
sched_disable
has been called) cannot end untilsched_enable
is called. We recommend disabling the time slicing when performing print statements. Unexpected results may occur.