
CHAPTER 7 TIME MANAGEMENT
User’s Manual U14833EJ2V0UM
85
7.3
Delaying Tasks
The execution of a task can be delayed by issuing the service call dly_tsk. If dly_tsk is issued, the task is put in the
waiting state and waits until the specified time has elapsed. It is therefore possible to delay the execution of a task for
a specified time. The delay time is specified in units of milliseconds, not in number of interrupt ticks.
7.4
Timeout
When a service call is issued that might put a task into a waiting state, such as waiting for wakeup or to acquire a
resource, it is possible to set the upper limit of this waiting time. The upper limit is known as the timeout time, and
when a task is released from waiting following the elapse of the timeout time, the task is said to have “timed out”.
When a task has timed out, the error code E_TMOUT is returned as the return value of the service call that caused
the task to wait, indicating that a timeout occurred. The timeout time is specified in units of milliseconds, not in
number of interrupt ticks.
Note that the relationship between the timeout time and the time until the task actually times out differs from that
specified in
μ
ITRON3.0. That is, because the kernel’s time management involves causing (discrete) interrupts to be
input at a fixed interval, there is a slight difference between the timeout time and the time that actually elapses. Unlike
μ
ITRON3.0 (RX4000 Ver3.0), in which control was performed to prevent the time that actually elapses exceeding the
specified timeout time, in
μ
ITRON4.0, because the timeout time is taken as the “minimum time that should elapse”,
timeout-specified tasks in the waiting state are timed out at the occurrence of the first time event (isig_tim) following
the elapse of the specified time, so that the time that actually elapses is never less than the timeout time.
The service calls that can make a timeout specification are shown in the table below.
Table 7-1. Service calls That Can Specify Timeout
Service call
Function
tslp_tsk
Waiting for reception of wakeup request
twai_sem
Acquiring a resource from a semaphore
twai_flg
Waiting for establishment of an event flag condition
tsnd_dtq
Transmitting data to a data queue
trcv_dtq
Receiving data from a data queue
trcv_mbx
Receiving mail from a mailbox
tloc_mtx
Locking a mutex
tget_mpf
Acquiring a memory block from a fixed-length memory pool
tget_mpl
Acquiring a memory block from a variable-length memory pool