|Download Help (Windows Only)|
Attempts to acquire an exclusive lock on the interface for the current process.
Assembly: NationalInstruments.NI4882 (in NationalInstruments.NI4882.dll) Version: 126.96.36.199
|Visual Basic (Declaration)|
Public Sub AcquireInterfaceLock ( _ timeout As Integer _ )
public void AcquireInterfaceLock( int timeout )
|GpibException||The NI-488.2 driver returns an error as a result of calling this method.|
|DllNotFoundException||The NI-488.2 driver library cannot be found.|
|EntryPointNotFoundException||A required operation in the NI-488.2 driver library cannot be found.|
The inner exception is set to the GpibException due to one of the following conditions:
Locks are not supported in the current NI-488.2 driver you are using.
Maximum reference count for the Board object has been reached.-or-
Unable to acquire the requested lock within the timeout period because a different process owns a lock for the interface.-or-
Nonexistent GPIB interface.-or-
Asynchronous I/O operation in progress.
|ObjectDisposedException||This member is called after the Dispose method has been called directly from your code or indirectly through a finalizer.|
If a process has acquired a lock, all GPIB calls by that process for that interface occur normally.
If a process has acquired a lock, all GPIB calls (except ReleaseInterfaceLock) by other processes for that interface fail immediately and throw InvalidOperationException. calls by other processes attempt to acquire a lock. The process throws an InvalidOperationException only after the timeout period has elapsed. throws an InvalidOperationException, but returns a valid Board object.and
Interface locks are exclusive and are not shareable among processes. If a process has a lock for an interface, no other process can acquire a lock associated with that interface.
A process may acquire multiple (redundant) locks on an interface. The NI-488.2 driver maintains a reference count of the number of outstanding locks per interface and does not unlock the interface until the reference count is 0. If the LastCount contains the number of locks remaining in effect for the Board object.call is successful—that is, if it does not return an exception—
An interface lock is associated with a process and a GPIB interface. An acquired lock remains in effect until the lock is released. Each successful call to acquire a lock should have a corresponding call to release the lock. Calling Dispose releases all interface locks held by that process for the interface described by the Board object.
A timeout of 0 specifies a 0 ms wait period. If the interface is locked by another process, returns immediately with InvalidOperationException. Otherwise, the process acquires the lock and returns.