osExitTask function
Declaration:
void osExitTask(
  ERROR ExitCode
);
Parameters:
ExitCode

The exit code to be associated with the terminating task.

Description:

This function terminates the calling task.

Upon termination, all critical sections owned by the task are released and marked as abandoned. If OS_ALLOW_OBJECT_DELETION is set to 1, all objects currently opened by the task are automatically closed.

If OS_TASK_EXIT_CODE_FUNC is enabled, the osGetTaskExitCode function can be used by other tasks to retrieve the exit code after the task has finished execution.

The osExitTask function stops the execution of the current task but does not immediately delete the task object instance. To remove the task object from the system, osCloseHandle must be called. A task object is deleted only after it has terminated and all tasks that held an open handle to it have closed those handles. If all handles are closed prior to task termination, the object will remain until the termination criteria are met.

Version:1.0
Header file:OS_Task.h (include OS_API.h)
See also: creating a task, ERROR, obtaining task exit code, OS_TASK_EXIT_CODE_FUNC, osCloseHandle, osGetTaskExitCode, tasks
SpaceShadow documentation