osSetTaskQuantum function
Declaration:
BOOL osSetTaskQuantum(
  HANDLE Handle,
  UINT8 Quantum
);
Parameters:
Handle

A handle to the task for which the time quantum is to be set.

Quantum

The new maximum number of time quanta to be assigned to the task. Valid values range from 1 to 255.

Return value:

Returns TRUE on success or FALSE on failure. Use the osGetLastError function to obtain extended error information.

Description:

This function sets the maximum number of time quanta assigned to the specified task.

When multiple tasks in the ready state share the same priority level, the scheduler ensures their concurrent execution by rapidly switching between them. The scheduler assigns a short CPU time slice, known as a time quantum, to each running task. For tasks performing long-running operations, you may configure the scheduler to allocate multiple CPU time slices to a specific task. By default, the scheduler assigns a single quantum. This function allows for the modification of this value. Only values between 1 and 255 are valid. To retrieve the current quantum value, use the osGetTaskQuantum function.

This function is available only when the OS_TASK_QUANTUM_FUNC constant is set to 1. If this functionality is not required, it can be disabled to reduce the memory footprint of the output code.

Version:1.0
Header file:OS_Task.h (include OS_API.h)
See also: BOOL, FALSE, HANDLE, OS_TASK_QUANTUM_FUNC, osGetLastError, scheduler, tasks, TRUE, using priority and time quanta
SpaceShadow documentation