ViStatus pi40iv_LockSession (ViSession instrumentHandle, ViPBoolean callerHasLock);
This function obtains a multithread lock on the instrument session. Before it does so, it waits until all other execution threads have released their locks on the instrument session.
Other threads might have obtained a lock on this session in the following ways:
- The user's application called pi40iv_LockSession.
- A call to the instrument driver locked the session.
- A call to the IVI engine locked the session.
After your call to pi40iv_LockSession returns successfully, no other threads can access the instrument session until you call pi40iv_UnlockSession.
Use pi40iv_LockSession and pi40iv_UnlockSession around a sequence of calls to instrument driver functions if you require that the instrument retain its settings through the end of the sequence.
You can safely make nested calls to pi40iv_LockSession within the same thread. To completely unlock the session, you must balance each call to pi40iv_LockSession with a call to pi40iv_UnlockSession. If, however, you use the Caller Has Lock parameter in all calls to pi40iv_LockSession and pi40iv_UnlockSession within a function, the IVI Library locks the session only once within the function regardless of the number of calls you make to pi40iv_LockSession. This allows you to call pi40iv_UnlockSession just once at the end of the function.
Input | ||
Name | Type | Description |
instrumentHandle | ViSession |
The ViSession handle that you obtain from the pi40iv_init or pi40iv_InitWithOptions function. The handle identifies a particular instrument session.
|
Output | ||
Name | Type | Description |
callerHasLock | ViBoolean (passed by reference) |
This parameter serves as a convenience. If you do not want to use this parameter, pass VI_NULL.
|
Name | Type | Description |
status | ViStatus |
Returns the status code of this operation. The status code either indicates success or describes an error or warning condition. You examine the status code from each call to an instrument driver function to determine if an error occurred.
|
Locking
Utility
Pickering Interfaces PXI/LXI IVI Switch
Alphabetical Function Index
Hierarchical Function Index