summaryrefslogtreecommitdiff
path: root/Mailman/pythonlib
diff options
context:
space:
mode:
authorbwarsaw1999-08-20 23:15:58 +0000
committerbwarsaw1999-08-20 23:15:58 +0000
commit6fa49c8587e4792bce76605e9212713789b1349f (patch)
tree901980ddd18e8ef139daa3b4d309a4dc6416c59d /Mailman/pythonlib
parent2b4cd80ad32a7fd41e37d7c411a45b85c7382257 (diff)
downloadmailman-6fa49c8587e4792bce76605e9212713789b1349f.tar.gz
mailman-6fa49c8587e4792bce76605e9212713789b1349f.tar.zst
mailman-6fa49c8587e4792bce76605e9212713789b1349f.zip
Several changes to make this a more generally useful module.
Most important: a semantic change. When a lock is acquired, an additional float value is written to the lock file. This is the lock's expected lifetime, as an instant some point in the future (i.e. time.time() + lifetime). This allows processes to give a clue to other claimants as to how long the lock holder intends to keep the lock. This is necessary because the same resource may need to be locked by short lived and long lived processes (e.g. the archiver). Without this, the short lived process has no idea when the lock owner should have given up the lock and could steal it out from under it. It is possible that a process could continually refresh a lock (see below) in an infloop, thus causing all other claimants to back off forever. This is (I believe) much less likely than that a process crashes, leaving a lock turd around. Rename this file to LockFile.py (retain flock.py for CVS archival purposes, but soon all references to this module will be changed to use LockFile instead of flock). The main class in this module is also named LockFile. All the exceptions have been changed to class-based. LockError is the base exception class. AlreadyCalledLockError is changed to AlreadyLockedError but NotLockedError and TimeOutError are not changed. New public methods set_lifetime() and refresh(). The former sets the lifetime interval so that the same lock object can be reused with a different lock lifetime. The latter refreshes the lock lifetime for an already held lock. A process can use this if it suddenly realizes it needs more time to complete its work. "hung_timeout" is renamed to lifetime, because of the changed semantics All private attributes have been __renamed Docstrings everywhere!
Diffstat (limited to 'Mailman/pythonlib')
0 files changed, 0 insertions, 0 deletions