tk_rsm_tsk
tk_frsm_tsk

Resume Task

Resume Task Force

[C Language Interface]

ER ercd = tk_rsm_tsk ( ID tskid ) ;
ER ercd = tk_frsm_tsk ( ID tskid ) ;

[Parameters]

ID	tskid	Task ID

[Return Parameters]

ER	ercd	Error code

[Error Codes]

E_OK     Normal completion
E_ID     Invalid ID number (tskid is invalid or cannot be used)
E_NOEXS  Object does not exist (the task specified in tskid does not exist)
E_OBJ    Invalid object state (the specified task is not in SUSPEND state (including when this system call
         specifies the invoking task or a task in DORMANT state))

[Description]

Releases the SUSPEND state of the task specified in tskid. If the target task was earlier put in SUSPEND state by the tk_sus_tsk system call, this system call releases that SUSPEND state and resumes the task execution.

When the target task is in a combined WAIT state and SUSPEND state (WAIT-SUSPEND state), executing tk_rsm_tsk releases only the SUSPEND state, putting the task in WAIT state. This system call cannot be issued for the invoking task. If the invoking task is specified, error code E_OBJ is returned.

Executing tk_rsm_tsk once clears only one nested suspend request (suscnt). If tk_sus_tsk was issued more than once for the target task (suscnt >= 2), the target task remains in SUSPEND state even after tk_rsm_tsk is executed. When tk_frsm_tsk is issued, on the other hand, all suspend requests are released (suscnt is cleared to 0) even if tk_sus_tsk was issued more than once (suscnt >= 2). The SUSPEND state is always cleared and unless the task was in WAIT-SUSPEND state, its execution resumes.

If the target task is neither suspended (SUSPEND state) nor WAITING-SUSPENDED (WAIT-SUSPEND state), error code E_OBJ is returned.

[Additional Notes]

After a task in RUN state or READY state is put in SUSPEND state by tk_sus_tsk and then resumed by tk_rsm_tsk or tk_frsm_tsk, the task has the lowest precedence among tasks of the same priority.

When, for example, the following system calls are executed for tasks A and B of the same priority, the result is as indicated below.


tk_sta_tsk (tskid=task_A, stacd_A);
tk_sta_tsk (tskid=task_B, stacd_B);
/* By the rule of FCFS, precedence becomes task_A --> task_B. */

tk_sus_tsk (tskid=task_A);
tk_rsm_tsk (tskid=task_A);
/* In this case precedence becomes task_B --> task_A. */

Comments

Click here to Post a Comment