Admin Production ni-theme
Current Publication

CmtReleaseThreadPoolFunctionID

LabWindows/CVI

CmtReleaseThreadPoolFunctionID

int CmtReleaseThreadPoolFunctionID (CmtThreadPoolHandle poolHandle, CmtThreadFunctionID threadFunctionID);

Purpose

Frees a Thread Function ID obtained from CmtScheduleThreadPoolFunction or CmtScheduleThreadPoolFunctionAdv. Call this function when you are done with the Thread Function ID. This function does not unschedule or interrupt a Thread Function that has not yet been executed or is currently executing. CmtDiscardThreadPool will automatically release any outstanding Thread Function IDs belonging to the thread pool being discarded.

If you pass NULL as the threadFunctionID parameter of the CmtScheduleThreadPoolFunction or CmtScheduleThreadPoolFunctionAdv functions, you do not have to call this function. In this case, the thread pool automatically frees the Function ID after it executes the Thread Function.

Parameters

Input
Name Type Description
poolHandle CmtThreadPoolHandle The handle you obtained from CmtNewThreadPool to identify the thread pool.

Pass DEFAULT_THREAD_POOL_HANDLE to specify the default thread pool.
threadFunctionID CmtThreadFunctionID The threadFunctionID that you obtained from CmtScheduleThreadPoolFunction or CmtScheduleThreadPoolFunctionAdv.

Note Note  This ID is not the same ID returned by CmtGetCurrentThreadID.

Return Value

Name Type Description
cmtStatus int 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.

Additional Information

Library: Utility Library

Include file: utility.h

LabWindows/CVI compatibility: LabWindows/CVI 5.5 and later

Examples

Refer to the following examples that use the CmtReleaseThreadPoolFunctionID function:

  • apps\daqmthread\daqMT.cws

    Open example
  • utility\threading\Simple\Simple.cws

    Open example
  • utility\threading\ThreadedGuessers\ThreadedGuessers.cws

    Open example
  • utility\threading\ThreadLocalVar\ThreadLocalVar.cws

    Open example
  • utility\threading\ThreadPool\MultiPanel\MultiPanel.cws

    Open example
  • utility\threading\ThreadPool\ParallelTestInit\ParallelTestInit.cws

    Open example