tk_rel_wai

Release Wait

[C Language Interface]

ER ercd = tk_rel_wai ( ID tskid ) ;

[Parameters]

ID	tskid	Task ID

[Return Parameters]

ER	ercd	Error code

[Error Codes]

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))

[Description]

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.

[Additional Notes]

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:

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_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

    Click here to Post a Comment