You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by jm...@apache.org on 2004/04/29 05:15:29 UTC

svn commit: rev 10400 - incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Locker

Author: jm
Date: Wed Apr 28 20:15:28 2004
New Revision: 10400

Modified:
   incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Locker/Flock.pm
Log:
calling unlock multiple times is OK, allow that without a warning

Modified: incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Locker/Flock.pm
==============================================================================
--- incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Locker/Flock.pm	(original)
+++ incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Locker/Flock.pm	Wed Apr 28 20:15:28 2004
@@ -107,7 +107,7 @@
   my ($self, $path) = @_;
 
   if (!exists $self->{lock_fhs} || !defined $self->{lock_fhs}->{$path}) {
-    warn "unlock: $$ no lock handle for $path\n";
+    dbg ("unlock: $$ no lock handle for $path - already unlocked?");
     return;
   }
 
@@ -120,11 +120,15 @@
   dbg("unlock: $$ unlocked $path.lock");
 
   # do NOT unlink! this would open a race, whereby:
+  #
   # procA: ....unlock                           (unlocked lockfile)
   # procB:            lock                      (gets lock on lockfile)
   # procA:                 unlink               (deletes lockfile)
   # (procB's lock is now deleted as well!)
   # procC:                        create, lock  (gets lock on new file)
+  #
+  # both procB and procC would then think they had locks, and both
+  # would write to the database file.  this is bad.
   #
   # unlink ("$path.lock"); 
   #