tk_chg_slt
Change Task Slice-time
ER ercd = tk_chg_slt ( ID tskid, RELTIM slicetime ) ;
ID tskid Task ID
RELTIM slice-time Time slice (ms)
ER ercd Error code
E_OK Normal completion
E_ID Invalid ID number (tskid is invalid or cannot be used)
E_NOEXS Object does not exist (the task specified in tskid does not exist)
E_PAR Parameter error (slicetime is invalid)
Changes the time slice of the task specified in tskid to the value specified in slicetime.
The time slice function is used for round robin scheduling of tasks. When a task runs continuously for the length of time specified in slicetime or longer, its precedence is switched to the lowest among tasks of the same priority, automatically yielding the execution privilege to the next task.
Setting slicetime = 0 indicates unlimited time, and the task does not automatically yield execution
privilege.
When a task is created, by default it is set to slicetime = 0. The invoking task can be specified by
setting tskid = TSK_SELF = 0.
Note, however, that when a system call is issued from a task-independent portion and tskid = TSK_SELF = 0 is specified, error code E_ID is returned.
The time slice as changed by this system call remains valid until the task is terminated. When the task reverts to DORMANT state, the time slice before termination is discarded, and the value at the time of task creation (slicetime = 0) is assigned. A time slice changed while the task is already in DORMANT state, however, becomes valid, being applied the next time the task is started.
The time while execution privilege is preempted by a higher-priority task does not count in the continuous run time; moreover, even if execution privilege is preempted by a higher-priority task, the run time is not treated as discontinuous. In other words, the time while execution privilege is preempted by a higher-priority task is ignored for the purposes of counting run time.
If the specified task is the only one running at its priority, the time slice is e.ectively meaningless and
the task runs continuously.
If a task of slicetime = 0 is included in tasks of the same priority, as soon as that task obtains execution right, round robin scheduling is stopped.
The method of counting run time is implementation-dependent, but does not need to be especially
precise. In fact, applications should not expect very high precision.

Comments