RTEMS Logo

RTEMS 4.7.99.2 On-Line Library


Task Manager ter_tsk - Terminate Other Task

PREV UP NEXT Bookshelf RTEMS ITRON 3.0 API User's Guide

1.4.6: ter_tsk - Terminate Other Task

CALLING SEQUENCE:

ER ter_tsk(
  ID tskid
);

STATUS CODES:

E_OK - Normal Completion

E_ID - Invalid ID Number (tskid was invalid or could not be used)

E_NOEXS - Object does not exist (the task specified by tskid does not exist)

E_OACV - Object access violation (A tskid less than -4 was specified from a user task. This is implementation dependent.)

E_OBJ - Invalid object state (the target task is already in DORMANT state or a task invalidly specified itself)

EN_OBJNO - An object number which could not be accessed on the target node is specified.

EN_CTXID - Specified an object on another node when the system call was issued from a task in dispatch disabled state or from a task-independent portion

DESCRIPTION:

This system call forcibly terminates the task specified by tskid. That is, it changes the state of the task specified by tskid into DORMANT.

Even if the target task is in wait state (including SUSPEND state), its wait state will be released and then it will be terminated. If the target task is on a queue of some sort (such as waiting for a semaphore), it will be removed from that queue by ter_tsk.

A task cannot specify the issuing task in this system call. An E_OBJ error will result if a task specifies itself.

There is an intermediate state waiting for the response (TR packet or TA packet) from the target node after executing the system call to access the other node and making a request (sending a TP packet) to the node. This state is called the "connection function response wait (TTW_NOD)" state. The ter_tsk system call may specify tasks which are in the connection function response wait state. Tasks which are waiting for objects (such as a semaphore) on another node may also be specified to this system call. In such cases, ter_tsk will halt any system calls accessing other nodes which have been issued by the task to be terminated.

NOTES:

When a task is terminated by ter_tsk, that task does not automatically release all the resources (memory blocks, semaphores, etc.) which it had obtained prior to the call. It is the user's responsibility to see to it that all resources are released beforehand.

In principle, information concerning a task recorded in the TCB, such as task priority, is reset whenever a task is placed in DORMANT state. For example, its task priority after being restarted would be reset to the initial task priority (itskpri) specified by cre_tsk when it was first created, even if a task's priority was changed using chg_pri, then that task is terminated by ter_tsk, but later started by sta_tsk. Task priority does not return to what it was when ter_tsk was executed.


PREV UP NEXT Bookshelf RTEMS ITRON 3.0 API User's Guide

Copyright © 1988-2004 OAR Corporation