diff options
| author | bwarsaw | 2002-01-11 00:51:20 +0000 |
|---|---|---|
| committer | bwarsaw | 2002-01-11 00:51:20 +0000 |
| commit | 26010ab00d9b9dfaa615d3a3c653513bac2f175e (patch) | |
| tree | 61963ae235b5d0623342746b636628ebf04f2ef4 /Mailman/LockFile.py | |
| parent | 0fdc0d80563e9f89928cdd87253cd73348c924b3 (diff) | |
| download | mailman-26010ab00d9b9dfaa615d3a3c653513bac2f175e.tar.gz mailman-26010ab00d9b9dfaa615d3a3c653513bac2f175e.tar.zst mailman-26010ab00d9b9dfaa615d3a3c653513bac2f175e.zip | |
Diffstat (limited to 'Mailman/LockFile.py')
| -rw-r--r-- | Mailman/LockFile.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/Mailman/LockFile.py b/Mailman/LockFile.py index ca888623c..fd390ddc8 100644 --- a/Mailman/LockFile.py +++ b/Mailman/LockFile.py @@ -1,4 +1,4 @@ -# Copyright (C) 1998,1999,2000,2001 by the Free Software Foundation, Inc. +# Copyright (C) 1998,1999,2000,2001,2002 by the Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -342,7 +342,9 @@ class LockFile: # a fork. Use at your own risk, but it should be race-condition safe. # _transfer_to() is called in the parent, passing in the pid of the # child. _take_possession() is called in the child, and blocks until the - # parent has transferred possession to the child. + # parent has transferred possession to the child. _disown() is used to + # set the __owned flag to 0, and it is a disgusting wart necessary to make + # forced lock acquisition work in mailmanctl. :( def _transfer_to(self, pid): # First touch it so it won't get broken while we're fiddling about. self.__touch() @@ -368,14 +370,17 @@ class LockFile: self.__writelog('transferred the lock') def _take_possession(self): - self.__tmpfname = '%s.%s.%d' % ( + self.__tmpfname = tmpfname = '%s.%s.%d' % ( self.__lockfile, socket.gethostname(), os.getpid()) # Wait until the linkcount is 2, indicating the parent has completed # the transfer. - while self.__linkcount() <> 2: + while self.__linkcount() <> 2 or self.__read() <> tmpfname: time.sleep(0.25) self.__writelog('took possession of the lock') + def _disown(self): + self.__owned = 0 + # # Private interface # |
