
74
Agilent VISA User’s Guide
3
Programming with VISA
Using Locks
In VISA, applications can open multiple sessions to a VISA resource
simultaneously. Applications can, therefore, access a VISA resource
concurrently through different sessions. However, in certain cases,
applications accessing a VISA resource may want to restrict other
applications from accessing that resource.
Lock Functions
For example, when an application needs to perform successive write
operations on a resource, the application may require that, during the
sequence of writes, no other operation can be invoked through any other
session to that resource. For such circumstances, VISA defines a
locking mechanism that restricts access to resources.
The VISA locking mechanism enforces arbitration of accesses to VISA
resources on a per-session basis. If a session locks a resource, operations
invoked on the resource through other sessions either are serviced or are
returned with an error, depending on the operation and the type of lock.
If a VISA resource is not locked by any of its sessions, all sessions have
full privilege to invoke any operation and update any global attributes.
Sessions are
not
required to have locks to invoke operations or update
global attributes. However, if some other session has already locked the
resource, attempts to update global attributes or invoke certain
operations will fail.
viLock/viUnlock Functions
The VISA
viLock
function is used to acquire a lock on a resource.
viLock(
vi
,
lockType
,
timeout
,
requestedKey
,
accessKey
);
The VI_ATTR_RSRC_LOCK_STATE attribute specifies the current
locking state of the resource on the given session, which can be either
VI_NO_LOCK, VI_EXCLUSIVE_LOCK, or VI_SHARED_LOCK.
The VISA
viUnlock
function is then used to release the lock on a
resource. If a resource is locked and the current session does not have
the lock, the error VI_ERROR_RSRC_LOCKED is returned.
Содержание E2094S
Страница 6: ...6 Agilent VISA User s Guide ...
Страница 116: ...116 Agilent VISA User s Guide 4 Programming via GPIB and VXI ...
Страница 126: ...126 Agilent VISA User s Guide 5 Programming via LAN ...
Страница 143: ...Glossary Agilent VISA User s Guide 143 Windows notification area See notification area ...
Страница 144: ...144 Agilent VISA User s Guide Glossary ...