Caché Basic Reference
Unlock
[Home] [Back] [Next]
InterSystems: The power behind what matters   
Class Reference   
Search:    

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
 
See Also