rtems_status_code rtems_task_restart( rtems_id id, rtems_task_argument argument );
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
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. The type of this
numeric argument is an unsigned integer type with the property that any valid
pointer to void can be converted to this type and then converted back to a
pointer to void. The result will compare equal to the original pointer. 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.
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.
Copyright © 1988-2008 OAR Corporation