Admin Production ni-theme
Current Publication

CmtDiscardLock

LabWindows/CVI

CmtDiscardLock

int CmtDiscardLock (CmtThreadLockHandle lockHandle);

Purpose

Uninitializes the thread lock.

You must call this function for every thread lock created by calling CmtNewLock. If the thread that calls this function currently owns the thread lock, this function returns an error. If another thread currently owns the thread lock, this function waits for the thread to release the lock before uninitializing the lock.

Parameters

Input
Name Type Description
lockHandle CmtThreadLockHandle The handle you obtained from CmtNewLock to identify the thread lock.

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 CmtDiscardLock function:

  • utility\threading\ThreadedGuessers\ThreadedGuessers.cws

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

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

    Open example