# CmtExitThreadPoolThread

int CmtExitThreadPoolThread (int returnValue);

## Purpose

Stops execution of the Thread Function immediately from within a Thread Function.

This function is typically used to terminate execution of a Thread Function when an error occurs.

This function does not terminate the thread. CmtExitThreadPoolThread returns the thread to the thread pool so that it can be used to execute other functions.

## Parameters

Input
Name | Type | Description
returnValue | integer | The value to return from the Thread Function. Call CmtGetThreadPoolFunctionAttribute with the ATTR_TP_FUNCTION_RETURN_VALUE attribute to get this value from another thread.

## Return Value

Name | Type | Description
CmtStatus | integer | The CmtStatus code that the function call returns. This function returns 0 to indicate success and negative values to indicate failure. Pass the CmtStatus code to CmtGetErrorMessage to get a description of the error code.