RTEMS Logo

RTEMS 4.7.2 On-Line Library


Task Manager TASK_RESTART - Restart a task

PREV UP NEXT Bookshelf RTEMS C User's Guide

5.4.4: TASK_RESTART - Restart a task

CALLING SEQUENCE:

rtems_status_code rtems_task_restart(
  rtems_id            id,
  rtems_task_argument argument
);

DIRECTIVE STATUS CODES:

RTEMS_SUCCESSFUL - task restarted successfully
RTEMS_INVALID_ID - task id invalid
RTEMS_INCORRECT_STATE - task never started
RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task

DESCRIPTION:

This directive resets the task specified by id to begin execution at its original starting address. The task's priority and execution mode are set to the original creation values. If the task is currently blocked, RTEMS automatically makes the task ready. A task can be restarted from any state, except the dormant state.

The task's starting argument is contained in argument. This argument can be a single value or an index into an array of parameter blocks. This new argument may be used to distinguish between the initial rtems_task_start of the task and any ensuing calls to rtems_task_restart of the task. This can be beneficial in deleting a task. Instead of deleting a task using the rtems_task_delete directive, a task can delete another task by restarting that task, and allowing that task to release resources back to RTEMS and then delete itself.

NOTES:

If id is RTEMS_SELF, the calling task will be restarted and will not return from this directive.

The calling task will be preempted if its preemption mode is enabled and the task being restarted has a higher priority.

The task must reside on the local node, even if the task was created with the RTEMS_GLOBAL option.


PREV UP NEXT Bookshelf RTEMS C User's Guide

Copyright © 1988-2004 OAR Corporation