Keysight VISA.NET Help
LockResource(Int32) Method



If this resource is locked, the absolute time period (in milliseconds) to wait for the resource to be unlocked before throwing an exception. If the value is VisaConstants.ImmediateTimeout (0), operations will never wait for the lock. If the value is VisaConstants.InfiniteTimeout (-1), the attempt to wait for the lock will never timeout. Negative values other than -1 are treated as unsigned values in the range between Int32.MaxValue and UInt32.MaxValue.
Acquires a lock on the resource for this session.
Syntax
'Declaration
 
Public Overloads Sub LockResource( _
   ByVal timeoutMilliseconds As Integer _
) 
'Usage
 
Dim instance As VisaSession
Dim timeoutMilliseconds As Integer
 
instance.LockResource(timeoutMilliseconds)
public void LockResource( 
   int timeoutMilliseconds
)
public:
void LockResource( 
   int timeoutMilliseconds
) 

Parameters

timeoutMilliseconds
If this resource is locked, the absolute time period (in milliseconds) to wait for the resource to be unlocked before throwing an exception. If the value is VisaConstants.ImmediateTimeout (0), operations will never wait for the lock. If the value is VisaConstants.InfiniteTimeout (-1), the attempt to wait for the lock will never timeout. Negative values other than -1 are treated as unsigned values in the range between Int32.MaxValue and UInt32.MaxValue.
Remarks

Since this overload does not specify a shared key, it will obtain an exclusive lock. Once an exclusive lock has been granted, any request for a shared lock will fail.

This overload returns after either acquiring the lock, or after waiting for the amount of time specified by the timeout.

This overload supports nested exclusive locks. For each session, LockResource and UnlockResource share an internal lock count, which is initialized to 0. Each successful call to LockResource on the same session (and for the same lock type) increases the lock count. When a session locks the resource a multiple number of times, it is necessary to invoke the UnlockResource method an equal number of times in order to unlock the resource. That is, the lock count increments for each call to LockResource, and decrements for each call to UnlockResource. A resource is actually unlocked only when the lock count is 0.

If the session holds both exclusive and shared locks, successive calls to UnlockResource will first decrement the exclusive lock count to 0, and then the shared lock count.

Requirements

Current with Keysight IO Libraries Suite 18

See Also

 

 


© Keysight Technologies 2015-2025