tk_wup_tsk
Wakeup Task
ER ercd = tk_wup_tsk ( 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 the invoking task or for a task in DORMANT state)
E_QOVR Queuing or nesting overflow (too many queued wakeup requests in wupcnt)
If the task specified in tskid was put in WAIT state by tk_slp_tsk, this system call releases the WAIT state.
This system call cannot be called for the invoking task. If the invoking task is specified, error code E_OBJ is returned.
If the target task has not called tk_slp_tsk and is not in WAIT state, the wakeup request by tk_wup_tsk is queued. That is, the calling of tk_wup_tsk for the target task is recorded, then when tk_slp_tsk is called after that, the task does not go to WAIT state. This is what is meant by queuing of wakeup requests.
The queuing of wakeup requests works as follows. Each task keeps a wakeup request queuing count (wupcnt) in its TCB.
Its initial value (when tk_sta_tsk is executed) is 0. When tk_wup_tsk is issued for a task not sleeping (not in WAIT state), the count is incremented by 1; but each time tk_slp_tsk is executed, the count is decremented by 1. When tk_slp_tsk is executed for a task whose wakeup queuing count is 0, the queuing count does not go into negative territory but rather the task goes to WAIT state. It is always possible to queue tk_wup_tsk one time (wupcnt = 1), but the maximum queuing count (wupcnt) is implementation-dependent and may be set to any appropriate value of 1 or above. In other words, issuing tk_wup_tsk once for a task not in WAIT state does not return error, but whether error is returned for the second or subsequent time tk_wup_tsk is called is an implementation-dependent matter. When calling tk_wup_tsk causes wupcnt to exceed the maximum allowed value, error code E_QOVR is returned.

Comments