Skip to main content

HS.Util.Scoped.Lockable

abstract class HS.Util.Scoped.Lockable

This class may be inherited by a %Persistent object to enable critical-section locking based on the id (effectively row/instance-locking). The two methods return a LockedId object which will keep the id locked for the duration of the lifetime of the returned object, unless explictly released earlier.
See: HS.Util.Scoped.LockedId

Method Inventory

Methods

classmethod GetExclusiveLock(pId As %String, pTimeoutSecs As %Integer, pThrowOnTimeout As %Boolean = 1) as HS.Util.Scoped.LockedId
Waits up to 'timeoutSecs' to acquire an exclusive lock on the specified id of this persistent class Returns a LockedId object which will release the lock upon a) an explicit call to its Release method, or b) when it goes out of scope.
If the lock is acquire within 'timeoutSecs', then out, a HS.Util.Scoped.LockedId instance is returned.
classmethod GetSharedLock(pId As %String, pTimeoutSecs As %Integer, pThrowOnTimeout As %Boolean = 1) as HS.Util.Scoped.LockedId
Waits up to 'timeoutSecs' to acquire shared lock on the specified id of this persistent class Returns a LockedId object which will release the lock upon a) an explicit call to its Release method, or b) when it goes out of scope.
If the lock is acquire within 'timeoutSecs', then out, a HS.Util.Scoped.LockedId instance is returned. Otherwise if 'throwOnTimeout' is 1 (default), the timeout status will be thrown, or, if 'throwOnTimeout' is 0 otherwise "" is returned.
FeedbackOpens in a new tab