30.12.2013 Views

T-Kernel Specification (1.B0.02)

T-Kernel Specification (1.B0.02)

T-Kernel Specification (1.B0.02)

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

4.2. TASK-DEPENDENT SYNCHRONIZATION FUNCTIONS 55<br />

tk wup tsk<br />

Wakeup Task<br />

[C Language Interface]<br />

ER ercd = tk_wup_tsk ( ID tskid ) ;<br />

[Parameters]<br />

ID tskid Task ID<br />

[Return Parameters]<br />

ER ercd Error code<br />

[Error Codes]<br />

E OK<br />

E ID<br />

E NOEXS<br />

E OBJ<br />

E QOVR<br />

Normal completion<br />

Invalid ID number (tskid is invalid or cannot be used)<br />

Object does not exist (the task designated in tskid does not exist)<br />

Invalid object state (called for the invoking task or for a task in DORMANT state)<br />

Queuing or nesting overflow (too many queued wakeup requests in wupcnt)<br />

[Description]<br />

If the task designated in tskid was put in WAIT state by tk slp tsk, this system call releases the<br />

WAIT state.<br />

This system call cannot be called for the invoking task. If the invoking task is designated, error code<br />

E OBJ is returned.<br />

If the target task has not called tk slp tsk and is not in WAIT state, the wakeup request by tk wup tsk<br />

is queued. That is, the calling of tk wup tsk for the target task is recorded, then when tk slp tsk is<br />

called after that, the task does not go to WAIT state. This is what is meant by queuing of wakeup<br />

requests.<br />

The queuing of wakeup requests works as follows. Each task keeps a wakeup request queuing count<br />

(wupcnt) in its TCB.<br />

Its initial value (when tk sta tsk is executed) is 0. When tk wup tsk is issued for a task not sleeping<br />

(not in WAIT state), the count is incremented by 1; but each time tk slp tsk is executed, the count<br />

is decremented by 1. When tk slp tsk is executed for a task whose wakeup queuing count is 0, the<br />

queuing count does not go into negative territory but rather the task goes to WAIT state.<br />

It is always possible to queue tk wup tsk one time (wupcnt = 1), but the maximum queuing count<br />

(wupcnt) is implementation-dependent and may be set to any appropriate value of 1 or above. In other<br />

words, issuing tk wup tsk once for a task not in WAIT state does not return error, but whether error is<br />

returned for the second or subsequent time tk wup tsk is called is an implementation-dependent matter.<br />

When calling tk wup tsk causes wupcnt to exceed the maximum allowed value, error code E QOVR is<br />

returned.<br />

Copyright c○ 2002, 2003 by T-Engine Forum<br />

T-<strong>Kernel</strong> <strong>1.B0.02</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!