Attributes for CmtGetThreadPoolFunctionAttribute

This topic describes the attributes that you can use with the multithreading function CmtGetThreadPoolFunctionAttribute:

Return Value ATTR_TP_FUNCTION_RETURN_VALUE
Thread ID ATTR_TP_FUNCTION_THREAD_ID
Thread Handle ATTR_TP_FUNCTION_THREAD_HANDLE
Execution Status ATTR_TP_FUNCTION_EXECUTION_STATUS

ATTR_TP_FUNCTION_RETURN_VALUE

Type: int

Restrictions: Not settable.

Description: This attribute specifies the return value of the Thread Function.

The value of this attribute can only be obtained when the Thread Function has finished executing. Call CmtGetThreadPoolFunctionAttribute with the ATTR_TP_FUNCTION_EXECUTION_STATUS attribute to get the execution state of the function.

ATTR_TP_FUNCTION_THREAD_ID

Type: unsigned int

Restrictions: Not settable.

Description: This attribute specifies the thread ID of the thread that is executing or executed the Thread Function.

The value of this attribute can only be obtained while the Thread Function is executing or when the Thread Function has finished executing. Call CmtGetThreadPoolFunctionAttribute with the ATTR_TP_FUNCTION_EXECUTION_STATUS attribute to get the execution state of the function.

ATTR_TP_FUNCTION_THREAD_HANDLE

Type: HANDLE

Restrictions: Not settable.

Description: This attribute specifies the thread handle of the thread that is executing or did execute the Thread Function. Do not call CloseHandle on this handle.

The value of this attribute can only be obtained while the Thread Function is executing or when the Thread Function has finished executing. Call CmtGetThreadPoolFunctionAttribute with the ATTR_TP_FUNCTION_EXECUTION_STATUS attribute to get the execution state of the function.

ATTR_TP_FUNCTION_EXECUTION_STATUS

Type: int

Restrictions: Not settable.

Description: This attribute specifies the execution status of the function.

Values

Defined Constant Value/
Description
kCmtThreadFunctionWaitingToExecute 0
The function is waiting for a thread to become available to execute it.
kCmtThreadFunctionPreExecution 1
A thread is assigned to the function, but has not yet begun to execute it.
kCmtThreadFunctionExecuting 2
The function is currently executing.
kCmtThreadFunctionPostExecution 3
The function has finished executing, but the thread has not yet been returned to the pool.
kCmtThreadFunctionComplete 4
The function finished executing.
kCmtThreadFunctionThreadTerminated 5
The thread that was executing the function was terminated abnormally.