summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbwarsaw1998-12-18 00:10:54 +0000
committerbwarsaw1998-12-18 00:10:54 +0000
commitc02ebd25b6432a5100260ec4a6d3ec3f13c77d2e (patch)
tree18bae34c9453320def4129fd5f73f22a2710ff2c
parent2cb381ad83f43e7cfca44cd14144bd100f277990 (diff)
downloadmailman-c02ebd25b6432a5100260ec4a6d3ec3f13c77d2e.tar.gz
mailman-c02ebd25b6432a5100260ec4a6d3ec3f13c77d2e.tar.zst
mailman-c02ebd25b6432a5100260ec4a6d3ec3f13c77d2e.zip
FileLock.steal(): New method which just basically writes a new PID
into the lock file. USE WITH CAUTION. Necessary because in the new news/mail gating code, the parent acquires the lock, and if successful, the child will steal it from the parent and then unlock it when done. This should be safe, with a very small race window, if any.
-rw-r--r--Mailman/LockFile.py4
-rw-r--r--Mailman/flock.py4
2 files changed, 8 insertions, 0 deletions
diff --git a/Mailman/LockFile.py b/Mailman/LockFile.py
index e8f44675b..3fb7a5244 100644
--- a/Mailman/LockFile.py
+++ b/Mailman/LockFile.py
@@ -167,3 +167,7 @@ class FileLock:
return 0
pid, winner = self.__read()
return pid == os.getpid()
+
+ # use with caution!!!
+ def steal(self):
+ self.__write()
diff --git a/Mailman/flock.py b/Mailman/flock.py
index e8f44675b..3fb7a5244 100644
--- a/Mailman/flock.py
+++ b/Mailman/flock.py
@@ -167,3 +167,7 @@ class FileLock:
return 0
pid, winner = self.__read()
return pid == os.getpid()
+
+ # use with caution!!!
+ def steal(self):
+ self.__write()