Skip to main content

This is documentation for Caché & Ensemble.

For information on converting to InterSystems IRIS, see the InterSystems IRIS Adoption Guide and the InterSystems IRIS In-Place Conversion Guide, both available on the WRC Distributions page (login required).

Previous sectionNext section

Unlock

Releases a logical lock on a variable name.

Synopsis

Unlock(varname)

Arguments

varname Name of the variable to be unlocked.

Description

Each time a lock is obtained on a varname a lock count is incremented. Unlock decrements this count. Only when the lock count falls to zero will the logical lock be released. For this reason, you should balance each call to Lock with a corresponding call to Unlock.

Examples

The following example uses the Lock function to obtain a logical lock on a global variable name (glvn) with a timeout of 10 seconds, and then uses the Unlock function to release the logical lock.

If Lock(^PatientData(PatientID),10) = True Then
  Println "Got the Lock"
  Unlock(^PatientData(PatientID))     'Release the logical lock
Else
  Println "Couldn't get the lock"
End If
Copy code to clipboard

See Also