Lock Types

NI-VISA

Lock Types

VISA defines two different types, or modes, of locks: exclusive and shared locks, which are denoted by VI_EXCLUSIVE_LOCK and VI_SHARED_LOCK, respectively. viLock() is used to acquire a lock on a resource, and viUnlock() is used to release the lock.

If a session has an exclusive lock, other sessions cannot modify global attributes or invoke operations, but can still get attributes and set local attributes. If the session has a shared lock, other sessions that have shared locks can also modify global attributes and invoke operations.

Regardless of which type of lock a session has, if the session is closed without first being unlocked, VISA automatically performs a viUnlock() on that session.