@@ -465,7 +465,7 @@ Error OnDiskOutputFile::keep() {
465
465
if (Error Err = Lock.tryLock ().moveInto (Owned)) {
466
466
// If we error acquiring a lock, we cannot ensure appends
467
467
// to the trace file are atomic - cannot ensure output correctness.
468
- Lock.unsafeRemoveLockFile ();
468
+ Lock.unsafeMaybeUnlock ();
469
469
return convertToOutputError (
470
470
OutputPath, std::make_error_code (std::errc::no_lock_available));
471
471
}
@@ -477,27 +477,27 @@ Error OnDiskOutputFile::keep() {
477
477
return convertToOutputError (OutputPath, EC);
478
478
Out << (*Content)->getBuffer ();
479
479
Out.close ();
480
- Lock.unsafeRemoveLockFile ();
480
+ Lock.unsafeMaybeUnlock ();
481
481
if (Out.has_error ())
482
482
return convertToOutputError (OutputPath, Out.error ());
483
483
// Remove temp file and done.
484
484
(void )sys::fs::remove (*TempPath);
485
485
return Error::success ();
486
486
}
487
487
// Someone else owns the lock on this file, wait.
488
- switch (Lock.waitForUnlock ( 256 )) {
489
- case llvm::LockFileManager::Res_Success :
488
+ switch (Lock.waitForUnlockFor ( std::chrono::seconds ( 256 ) )) {
489
+ case WaitForUnlockResult::Success :
490
490
LLVM_FALLTHROUGH;
491
- case llvm::LockFileManager::Res_OwnerDied : {
491
+ case WaitForUnlockResult::OwnerDied : {
492
492
continue ; // try again to get the lock.
493
493
}
494
- case llvm::LockFileManager::Res_Timeout : {
494
+ case WaitForUnlockResult::Timeout : {
495
495
// We could error on timeout to avoid potentially hanging forever, but
496
496
// it may be more likely that an interrupted process failed to clear
497
497
// the lock, causing other waiting processes to time-out. Let's clear
498
498
// the lock and try again right away. If we do start seeing compiler
499
499
// hangs in this location, we will need to re-consider.
500
- Lock.unsafeRemoveLockFile ();
500
+ Lock.unsafeMaybeUnlock ();
501
501
continue ;
502
502
}
503
503
}
0 commit comments