[llvm] r228603 - Reduce the LockFileManager timeout, and provide unsafeRemoveLockFile
Ben Langmuir
blangmuir at apple.com
Mon Feb 9 12:34:25 PST 2015
Author: benlangmuir
Date: Mon Feb 9 14:34:24 2015
New Revision: 228603
URL: http://llvm.org/viewvc/llvm-project?rev=228603&view=rev
Log:
Reduce the LockFileManager timeout, and provide unsafeRemoveLockFile
5 minutes is an eternity, so try to strike a better balance between
waiting long enough for any reasonable module build and not so long that
users kill the process because they think it's hanging.
Also give the client a way to delete the lock file after a timeout.
Modified:
llvm/trunk/include/llvm/Support/LockFileManager.h
llvm/trunk/lib/Support/LockFileManager.cpp
Modified: llvm/trunk/include/llvm/Support/LockFileManager.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/LockFileManager.h?rev=228603&r1=228602&r2=228603&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/LockFileManager.h (original)
+++ llvm/trunk/include/llvm/Support/LockFileManager.h Mon Feb 9 14:34:24 2015
@@ -77,6 +77,10 @@ public:
/// \brief For a shared lock, wait until the owner releases the lock.
WaitForUnlockResult waitForUnlock();
+
+ /// \brief Remove the lock file. This may delete a different lock file than
+ /// the one previously read if there is a race.
+ std::error_code unsafeRemoveLockFile();
};
} // end namespace llvm
Modified: llvm/trunk/lib/Support/LockFileManager.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/LockFileManager.cpp?rev=228603&r1=228602&r2=228603&view=diff
==============================================================================
--- llvm/trunk/lib/Support/LockFileManager.cpp (original)
+++ llvm/trunk/lib/Support/LockFileManager.cpp Mon Feb 9 14:34:24 2015
@@ -186,8 +186,8 @@ LockFileManager::WaitForUnlockResult Loc
Interval.tv_sec = 0;
Interval.tv_nsec = 1000000;
#endif
- // Don't wait more than five minutes for the file to appear.
- unsigned MaxSeconds = 300;
+ // Don't wait more than one minute for the file to appear.
+ unsigned MaxSeconds = 60;
bool LockFileGone = false;
do {
// Sleep for the designated interval, to allow the owning process time to
@@ -263,3 +263,7 @@ LockFileManager::WaitForUnlockResult Loc
// Give up.
return Res_Timeout;
}
+
+std::error_code LockFileManager::unsafeRemoveLockFile() {
+ return sys::fs::remove(LockFileName.str());
+}
More information about the llvm-commits
mailing list