From 236eb59293194071ac518c12d0cc6fe0a3f0ac5f Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 6 Aug 2003 09:34:04 +0000 Subject: [PATCH] * 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. --- src/pathlocks.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pathlocks.cc b/src/pathlocks.cc index fc05a7b55..78aae26bd 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);