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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

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

tk sus tsk<br />

Suspend Task<br />

[C Language Interface]<br />

ER ercd = tk_sus_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 CTX<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 />

A task in RUN state was designated in dispatch disabled state<br />

Queuing or nesting overflow (too many nested requests in suscnt)<br />

[Description]<br />

Puts the task designated in tskid in SUSPEND state and interrupts execution by the task.<br />

SUSPEND state is released by issuing system call tk rsm tsk or tk frsm tsk.<br />

If tk sus tsk is called for a task already in WAIT state, the state goes to a combination of WAIT state<br />

and SUSPEND state (WAIT-SUSPEND state). Thereafter when the task wait release conditions are<br />

met, the task goes to SUSPEND state. If tk rsm tsk is issued for the task in WAIT-SUSPEND state,<br />

the task state reverts to WAIT state.<br />

Since SUSPEND state means task interruption by a system call issued by another task, this system call<br />

cannot be issued for the invoking task. If the invoking task is designated, error code E OBJ is returned.<br />

When this system call is issued from a task-independent portion, if a task in RUN state is designated<br />

while dispatching is disabled, error code E CTX is returned.<br />

If tk sus tsk is issued more than once for the same task, the task is put in SUSPEND state multiple<br />

times. This is called nesting of suspend requests. In this case, the task reverts to its original state only<br />

when tk rsm tsk has been issued for the same number of times as tk sus tsk (suscnt). Accordingly,<br />

nesting of the pair tk sus tsk — tk rsm tsk is possible.<br />

The nesting of suspend requests (issuing tk sus tsk two or more times for the same task) and limits<br />

on nesting count are implementation-dependent.<br />

If tk sus tsk is issued multiple times in a system that does not allow suspend request nesting, or if the<br />

nesting count exceeds the allowed limit, error code E QOVR is 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!