Skip to content

NI DIGITAL PATTERN DRIVER Session Locking Functions

ShantanuShinde edited this page May 24, 2021 · 2 revisions

Session Locking Functions

niDigital_LockSession

Obtains the multithreaded lock on the instrument session. Before doing so, the function waits until all other execution threads have released the lock on the instrument session. Other threads might have obtained the lock on this session in the following ways:

  • Your application called niDigital_LockSession
  • A call to the digital pattern instrument driver locked the session
  • A call to the IVI engine locked the session

After the call to niDigital_LockSession returns successfully, no other threads can access the instrument session until you call niDigital_UnlockSession. Use niDigital_LockSession and niDigital_UnlockSession around a sequence of calls to instrument driver functions if you require exclusive access through the end of the sequence.

You can safely make nested calls to niDigital_LockSession within the same thread. To completely unlock the session, you must balance each call to niDigital_LockSession with a call to niDigital_UnlockSession. If, however, you use the callerHasLock parameter in all calls to niDigital_LockSession and niDigital_UnlockSession within a function, the IVI Library locks the session only once within the function, regardless of the number of calls you make to niDigital_LockSession. This functionality allows you to call niDigital_UnlockSession just once at the end of the function.

C Function Prototype: ViStatus niDigital_LockSession (ViSession vi, ViBoolean* callerHasLock)

Parameter Description
vi The specified instrument session the niDigital_init or niDigital_InitWithOptions function returns.
callerHasLock This parameter serves as a convenience. If you do not want to use this parameter, pass VI_NULL. You can use this parameter in complex functions to track lock status and the need to unlock the session. Pass the address of a local ViBoolean variable in the declaration of the local variable and initialize it to VI_FALSE. Also, pass the address of the same local variable to any other calls you make to niDigital_LockSession or niDigital_UnlockSession in the same function.

Return value: Reports the status of the operation.

niDigital_UnlockSession

Releases a lock that you acquired on an instrument session using the niDigital_LockSession function.

C Function Prototype: ViStatus niDigital_UnlockSession (ViSession vi, ViBoolean* callerHasLock)

Parameter Description
vi The specified instrument session the niDigital_init or niDigital_InitWithOptions function returns.
callerHasLock This parameter serves as a convenience. If you do not want to use this parameter, pass VI_NULL. You can use this parameter in complex functions to track lock status and the need to unlock the session. Pass the address of a local ViBoolean variable in the declaration of the local variable and initialize it to VI_FALSE. Also, pass the address of the same local variable to any other calls you make to niDigital_LockSession or niDigital_UnlockSession in the same function.

Return value: Reports the status of the operation.

Table of Contents

Internal Development

Creating and Setting Up a gRPC Server

Server Security Support

Creating a gRPC Client

gRPC Client Examples

Session Utilities API Reference

Driver Documentation

gRPC API Differences From C API

Sharing Driver Sessions Between Clients

C API Docs
NI-DAQmx
NI-DCPOWER
NI-DIGITAL PATTERN DRIVER
NI-DMM
NI-FGEN
NI-FPGA
NI-RFmx Bluetooth
NI-RFmx NR
NI-RFmx WCDMA
NI-RFmx GSM
NI-RFmx CDMA2k
NI-RFmx Instr
NI-RFmx LTE
NI-RFmx SpecAn
NI-RFmx TD-SCDMA
NI-RFmx WLAN
NI-RFSA
NI-RFSG
NI-SCOPE
NI-SWITCH
NI-TCLK
NI-XNET
Clone this wiki locally