@@ -465,7 +465,7 @@ Error OnDiskOutputFile::keep() {
465465 if (Error Err = Lock.tryLock ().moveInto (Owned)) {
466466 // If we error acquiring a lock, we cannot ensure appends
467467 // to the trace file are atomic - cannot ensure output correctness.
468- Lock.unsafeRemoveLockFile ();
468+ Lock.unsafeMaybeUnlock ();
469469 return convertToOutputError (
470470 OutputPath, std::make_error_code (std::errc::no_lock_available));
471471 }
@@ -477,27 +477,27 @@ Error OnDiskOutputFile::keep() {
477477 return convertToOutputError (OutputPath, EC);
478478 Out << (*Content)->getBuffer ();
479479 Out.close ();
480- Lock.unsafeRemoveLockFile ();
480+ Lock.unsafeMaybeUnlock ();
481481 if (Out.has_error ())
482482 return convertToOutputError (OutputPath, Out.error ());
483483 // Remove temp file and done.
484484 (void )sys::fs::remove (*TempPath);
485485 return Error::success ();
486486 }
487487 // 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 :
490490 LLVM_FALLTHROUGH;
491- case llvm::LockFileManager::Res_OwnerDied : {
491+ case WaitForUnlockResult::OwnerDied : {
492492 continue ; // try again to get the lock.
493493 }
494- case llvm::LockFileManager::Res_Timeout : {
494+ case WaitForUnlockResult::Timeout : {
495495 // We could error on timeout to avoid potentially hanging forever, but
496496 // it may be more likely that an interrupted process failed to clear
497497 // the lock, causing other waiting processes to time-out. Let's clear
498498 // the lock and try again right away. If we do start seeing compiler
499499 // hangs in this location, we will need to re-consider.
500- Lock.unsafeRemoveLockFile ();
500+ Lock.unsafeMaybeUnlock ();
501501 continue ;
502502 }
503503 }
0 commit comments