RTEMS provides the rtems.task_delete
directive to allow a task to
delete itself or any other task. This directive removes all
RTEMS references to the task, frees the task's control block,
removes it from resource wait queues, and deallocates its stack
as well as the optional floating point context. The task's name
and ID become inactive at this time, and any subsequent
references to either of them is invalid. In fact, RTEMS may
reuse the task ID for another task which is created later in the
application.
Unexpired delay timers (i.e. those used by
rtems.task_wake_after
and
rtems.task_wake_when
) and
timeout timers associated with the task are
automatically deleted, however, other resources dynamically
allocated by the task are NOT automatically returned to RTEMS.
Therefore, before a task is deleted, all of its dynamically
allocated resources should be deallocated by the user. This may
be accomplished by instructing the task to delete itself rather
than directly deleting the task. Other tasks may instruct a
task to delete itself by sending a "delete self" message, event,
or signal, or by restarting the task with special arguments
which instruct the task to delete itself.
Copyright © 1988-2000 OAR Corporation