Package buildbot :: Module locks :: Class BaseLock
[frames] | no frames]

Class BaseLock

source code

Known Subclasses:

Class handling claiming and releasing of self, and keeping track of current and waiting owners.

We maintain the wait queue in FIFO order, and ensure that counting waiters in the queue behind exclusive waiters cannot acquire the lock. This ensures that exclusive waiters are not starved.

Instance Methods
 
__init__(self, name, maxCount=1) source code
 
__repr__(self) source code
 
isAvailable(self, requester, access)
Return a boolean whether the lock is available for claiming
source code
 
claim(self, owner, access)
Claim the lock (lock must be available)
source code
 
subscribeToReleases(self, callback)
Schedule callback to be invoked every time this lock is released.
source code
 
release(self, owner, access)
Release the lock
source code
 
waitUntilMaybeAvailable(self, owner, access)
Fire when the lock *might* be available.
source code
 
stopWaitingUntilAvailable(self, owner, access, d) source code
 
isOwner(self, owner, access) source code
Class Variables
  description = '<BaseLock>'
Method Details

subscribeToReleases(self, callback)

source code 

Schedule callback to be invoked every time this lock is released. Returns a Subscription.

waitUntilMaybeAvailable(self, owner, access)

source code 

Fire when the lock *might* be available. The caller will need to check with isAvailable() when the deferred fires. This loose form is used to avoid deadlocks. If we were interested in a stronger form, this would be named 'waitUntilAvailable', and the deferred would fire after the lock had been claimed.