about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2003-08-06T09·34+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2003-08-06T09·34+0000
commit236eb59293194071ac518c12d0cc6fe0a3f0ac5f (patch)
treeed337f655ad4e250a186ce20697a0e292f77bffd
parent720f06e3b05502df2dc84afb7a3ad2ea5518246a (diff)
* Allow locks on paths to be acquired recursively (that is, if the
  process is already holding a lock on a path, it may acquire the lock
  again without blocking or failing).  (This might be dangerous, not
  sure).  Necessary for fast builds to work.

-rw-r--r--src/pathlocks.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/pathlocks.cc b/src/pathlocks.cc
index fc05a7b5508c..78aae26bdb64 100644
--- a/src/pathlocks.cc
+++ b/src/pathlocks.cc
@@ -28,8 +28,10 @@ PathLocks::PathLocks(const Strings & _paths)
 
         debug(format("locking path `%1%'") % path);
 
-        if (lockedPaths.find(lockPath) != lockedPaths.end())
-            throw Error(format("already holding lock on `%1%'") % lockPath);
+        if (lockedPaths.find(lockPath) != lockedPaths.end()) {
+            debug(format("already holding lock on `%1%'") % lockPath);
+            continue;
+        }
         
         /* Open/create the lock file. */
         int fd = open(lockPath.c_str(), O_WRONLY | O_CREAT, 0666);