tk_rel_wai
Release Wait
ER ercd = tk_rel_wai ( ID tskid ) ;
ID tskid Task ID
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_OBJ Invalid object state (called for a task not in WAIT state (including when called for the invoking task, or for a task in DORMANT state))
If the task specified in tskid is in some kind of wait state (not including SUSPEND state), forcibly releases that state.
This system call returns error code E_RLWAI to the task whose WAIT state was released.
Wait release requests by tk_rel_wai are not queued. That is, if the task specified in tskid is already in WAIT state, the WAIT state is cleared; but if it is not in WAIT state when this system call is issued, error code E_OBJ is returned to the caller. Likewise, error code E_OBJ is returned when this system call is issued specifying the invoking task.
The tk_rel_wai system call does not release a SUSPEND state. If it is issued for a task in WAITSUSPEND state, the task goes to SUSPEND state. If it is necessary to release SUSPEND state, the separate system call tk_frsm_tsk is used. The states of the target task when tk_rel_wai is called and the results of its execution in each state are shown in Table 4.3.
A function similar to timeout can be realized by using an alarm handler or the like to issue this system call after a given task has been in WAIT state for a set time.
The main differences between tk_rel_wai and tk_wup_tsk are the following.
- Whereas tk_wup_tsk releases only WAIT state e.ected by tk_slp_tsk, tk_rel_wai releases also .WAIT state caused by other factors (tk_wai_flg, tk_wai_sem, tk_rcv_msg, tk get blk, etc.).
Target Task State
tk_rel_tsk ercd Parameter
Processing
Run state (RUN, READY)(not for invoking task)
E_OBJ
No operation
RUN state(for invoking task)
E_OBJ
No operation
WAIT state
E_OK
Wait released.*
DORMANT state
E_OBJ
Wait released.
NON-EXISTENT state
E_NOEXS
Wait released.
*Error code E_RLWAI is returned to the target task. The target task is guaranteed to be released from its wait state without any resource allocation (without the wait release conditions being met).
Table 4.3: Task States and Results of tk_rel_wai Execution
- Seen from the task in WAIT state, release of the WAIT state by tk_wup_tsk returns a Normal completion (E_OK), whereas release by tk_rel_wai returns an error code (E_RLWAI).
- Wakeup requests by tk_wup_tsk are queued if tk_slp_tsk has not yet been executed. If tk_rel_wai is issued for a task not in WAIT state, error code E_OBJ is returned.

Comments