
CHAPTER 4 TASK MANAGEMENT
User’s Manual U14833EJ2V0UM
39
4.8
Task Delay and Timeout
Tasks in the waiting state described in
4.6 (5) Waiting
above can be released after an arbitrary period of time has
elapsed. It is also possible to delay the execution of a task for a specified amount of time using the service call
dly_tsk. This kind of processing is known as timer operation. For details of timer operation, refer to
CHAPTER 7
TIME MANAGEMENT
. Timer operation as related to tasks is summarized below.
(1) Timeout
When a task is shifted to the waiting state, the maximum time that task is to stay in the waiting state can be set
by specifying a timeout time. In other words, if the wait release conditions are not met before the specified time
elapses after a service call was issued, the task is forcibly released from the waiting state. This is known as
timeout.
The error code E_TMOUT indicating a timeout is returned as the return value of a service call for tasks in a
timeout state.
(2) Time elapse wait
A task can be made to stay in the waiting state for only a specified time by issuing the service call dly_tsk. In
other words, a task is subject to waiting for a specified time, after the elapse of which the task is released.
4.9
Task Priority Order
A task has three values related to its priority: its initial priority, its current priority, and its base priority. In the
RX4000, the lower the value of the priority assigned to a task, the higher the priority.
(1) Initial priority
This is the priority of a task immediately after activation. This value can only be specified when the task is
created, and cannot be subsequently changed. When a task terminates and is reactivated, its priority is
initialized to this value.
(2) Current priority
This value indicates the priority of the task after it has been activated. The task execution order or the place of
a task in the task queue is determined by its current priority value. The current priorities of tasks can be
dynamically changed by the service call chg_pri (ichg_pri) and can be obtained by the service call get_pri
(iget_pri).
(3) Base priority
When a task is not participating in mutex-based synchronization, the base priority is always the same as the
current priority. When the task is synchronized using a mutex, the current priority of the task may change,
depending on the priority control protocol of the target mutex. At this time, the priority order to which the task
returns after releasing the mutex lock is known as the base priority.