DISCUSSION
Tasks are created in the unblocked state, ready for execution. A task can terminate in the following ways:
-
By returning from its entry point
-
By calling MPExit
-
When specified as the target of an MPTerminateTask
call
-
If a hardware-detected exception or programming exception occurs and no exception handler is installed
-
If the application calls ExitToShell
Task resources (its stack, active timers, internal structures related to the task, and so on) are reclaimed by the system when the task terminates. The task's address space is inherited from the process address space. All existing tasks are terminated when the owning process terminates.