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 57<br />

tk rel wai<br />

Release Wait<br />

[C Language Interface]<br />

ER ercd = tk_rel_wai ( 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 />

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 a task not in WAIT state (including when called for the<br />

invoking task, or for a task in DORMANT state))<br />

[Description]<br />

If the task designated in tskid is in some kind of wait state (not including SUSPEND state), forcibly<br />

releases that state.<br />

This system call returns error code E RLWAI to the task whose WAIT state was released.<br />

Wait release requests by tk rel wai are not queued. That is, if the task designated in tskid is already<br />

in WAIT state, the WAIT state is cleared; but if it is not in WAIT state when this system call is issued,<br />

error code E OBJ is returned to the caller. Likewise, error code E OBJ is returned when this system call<br />

is issued designating the invoking task.<br />

The tk rel wai system call does not release a SUSPEND state. If it is issued for a task in WAIT-<br />

SUSPEND state, the task goes to SUSPEND state. If it is necessary to release SUSPEND state, the<br />

separate system call tk frsm tsk is used. The states of the target task when tk rel wai is called and<br />

the results of its execution in each state are shown in Table 4.3.<br />

[Additional Notes]<br />

A function similar to timeout can be realized by using an alarm handler or the like to issue this system<br />

call after a given task has been in WAIT state for a set time.<br />

The main differences between tk rel wai and tk wup tsk are the following.<br />

• Whereas tk wup tsk releases only WAIT state effected by tk slp tsk, tk rel wai releases also<br />

WAIT state caused by other factors (tk wai flg, tk wai sem, tk rcv msg, tk get blk, etc.).<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!