tk_rel_wai
Release Wait
See Also
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 also necessary to release SUSPEND state, the system call tk_frsm_tsk is issued instead of this system call. 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_tskreleases only WAIT state effected bytk_slp_tsk,tk_rel_waialso releases WAIT state caused by other factors (tk_wai_flg,tk_wai_sem,tk_rcv_msg,tk_get_blk, etc.).

Table 4.3: Task States and Results of tk_rel_wai Execution
- From the perspective of the task in WAIT state, release of the WAIT state by
tk_wup_tskreturns a Normal completion (E_OK), whereas release bytk_rel_waireturns an error code (E_RLWAI). - Wakeup requests by
tk_wup_tskare queued iftk_slp_tskhas not yet been executed. Iftk_rel_waiis issued for a task not in WAIT state, error codeE_OBJis returned.

Comments
Click here to Post a Comment