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

Class BaseLock

source code

Known Subclasses:

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


Note: Ideally, we'd like to maintain FIFO order. The place to do that would be the isAvailable() function. However, this function is called by builds/steps both for the first time, and after waking them up by self from the self.waiting queue. There is currently no way of distinguishing between them.

Instance Methods [hide private]
 
__init__(self, name, maxCount=1) source code
 
__repr__(self) source code
 
_getOwnersCount(self)
Return the number of current exclusive and counting owners.
source code
 
isAvailable(self, 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
 
release(self, owner, access)
Release the lock
source code
 
waitUntilMaybeAvailable(self, owner, access)
Fire when the lock *might* be available.
source code
Class Variables [hide private]
  description = '<BaseLock>'
Method Details [hide private]

_getOwnersCount(self)

source code 

Return the number of current exclusive and counting owners.

Returns:
Tuple (number exclusive owners, number counting owners)

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.