| Keysight.Visa Namespace > VisaSession Class > LockResource Method : LockResource() Method |
'DeclarationPublic Overloads Sub LockResource()
'UsageDim instance As VisaSession instance.LockResource()
public void LockResource()
public: void LockResource();
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 uses an infinite timeout as the default, so that it will return only after acquiring the lock.
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.
Current with Keysight IO Libraries Suite 18