mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-23 02:32:11 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228603 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
6194244842
commit
ea280d963d
@ -77,6 +77,10 @@ public:
|
|||||||
|
|
||||||
/// \brief For a shared lock, wait until the owner releases the lock.
|
/// \brief For a shared lock, wait until the owner releases the lock.
|
||||||
WaitForUnlockResult waitForUnlock();
|
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
|
} // end namespace llvm
|
||||||
|
@ -186,8 +186,8 @@ LockFileManager::WaitForUnlockResult LockFileManager::waitForUnlock() {
|
|||||||
Interval.tv_sec = 0;
|
Interval.tv_sec = 0;
|
||||||
Interval.tv_nsec = 1000000;
|
Interval.tv_nsec = 1000000;
|
||||||
#endif
|
#endif
|
||||||
// Don't wait more than five minutes for the file to appear.
|
// Don't wait more than one minute for the file to appear.
|
||||||
unsigned MaxSeconds = 300;
|
unsigned MaxSeconds = 60;
|
||||||
bool LockFileGone = false;
|
bool LockFileGone = false;
|
||||||
do {
|
do {
|
||||||
// Sleep for the designated interval, to allow the owning process time to
|
// Sleep for the designated interval, to allow the owning process time to
|
||||||
@ -263,3 +263,7 @@ LockFileManager::WaitForUnlockResult LockFileManager::waitForUnlock() {
|
|||||||
// Give up.
|
// Give up.
|
||||||
return Res_Timeout;
|
return Res_Timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::error_code LockFileManager::unsafeRemoveLockFile() {
|
||||||
|
return sys::fs::remove(LockFileName.str());
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user