RTEMS ITRON 3.0 API User's Guide
ER sus_tsk( ID tskid );
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 specified task is in DORMANT state or the issuing task specified itself)
E_QOVR
- Queuing or nesting overflow (the number of nesting levels given by suscnt went over the maximum allowed)
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
This system call suspends the execution of the task specified by tskid by putting it into SUSPEND state.
SUSPEND state is released by issuing the rsm_tsk or frsm_tsk system call. If the task specified to sus_tsk is already in WAIT state, it will be put in the combined WAIT-SUSPEND state by the execution of sus_tsk. If wait conditions for the task are later fulfilled, it will enter SUSPEND state. If rsm_tsk is issued on the task, it will return to the WAIT state before the suspension.
Since SUSPEND state indicates the suspension of execution by a system call issued from another task, a task may not specify itself to this system call. An E_OBJ error will result if a task specifies itself.
If more than one sus_tsk call is issued to a task, that task will be put in multiple SUSPEND states. This is called suspend request nesting. When this is done, rsm_tsk must be issued the same number of times which sus_tsk was issued (suscnt) in order to return the task to its original state before the suspension. This means it is possible to nest the pairs of sus_tsk and rsm_tsk.
The maximum number of times suspend requests may be nested, and even whether or not suspend request nesting (the ability to issue sus_tsk on the same task more than once) is even allowed, is implementation dependent. Suspend request nesting is considered an extended function [level X] for which compatibility and connectivity are not guaranteed.
An E_QOVR error will result if sus_tsk is issued more than once on the same task on a system which does not support suspend request nesting or if it is issued more than the maximum number of times allowed.
A task which is suspended in addition to waiting for resources (such as waiting for a semaphore) can be allocated resources (such as semaphore counts) based on the same conditions as tasks which are not suspended. Even when suspended, the allocation of resources is not delayed in any way. Conditions concerning resource allocation and release of the wait state remain unchanged. In other words, SUSPEND state is completely independent of other processing and task states. If it is desirable to delay the allocation of resources to a task which is suspended, the user should use chg_pri in conjunction with sus_tsk and rsm_tsk.
RTEMS ITRON 3.0 API User's Guide
Copyright © 1988-2007OAR Corporation