# exit

Exits from a task or thread.

### Synopsis

`void exit( int status )`

### Description

This procedure deletes the calling task or thread. If the CREATETASK_TAG_MSGFROMCHILD tag was set when creating the calling task, then the status is sent to the parent process through a message.

### Arguments

status
  The status to be returned to the parent of the calling task or thread. Negative status is reserved for system use.

### Return Value

This procedure never returns.

### Implementation

Folio call implemented in kernel folio V20.

### Associated Files

stdlib.h
  ANSI C Prototype

### Notes

When tasks (including threads) have finished their work, they should call `exit()` to die gracefully. The system will call `exit()` on behalf of the task that returns from the top-level routine. `exit()` does necessary clean-up work when a task is finished, including the cleanup required for a thread created by the `CreateThread()` library routine.

### See Also

``CreateThread`(), DeleteItem(), DeleteThread()`

#