CmtNewTSV
- Updated2023-02-21
- 1 minute(s) read
int CmtNewTSV (size_t variableSize, CmtTSVHandle *variableHandle);
Purpose
Creates a thread safe variable.
Use a thread safe variable to store information that must be accessed from more than one thread in your application. When you finish using the variable from all threads, you must call CmtDiscardThreadSafeVar to uninitialize the thread safe variable.
It is difficult to program with this function directly. It is easier to program with the functions provided by the DefineThreadSafeScalarVar, DefineThreadSafeArrayVar, DeclareThreadSafeScalarVar, and DeclareThreadSafeArrayVar macros, which are defined in utility.h.
Parameters
Input | ||
Name | Type | Description |
variableSize | size_t | The size, in bytes, of the data that you want to store in the thread safe variable. The sizeof operator is useful for this. The function returns an error if this value is greater than INT_MAX. |
Output | ||
Name | Type | Description |
variableHandle | CmtTSVHandle | Returns a handle that you use to identify the thread safe variable in subsequent function calls. The handle is never 0. |
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