Skip to content

Commit

Permalink
[8.0.0] Avoid a print loop when busy-waiting on the client lock on Wi…
Browse files Browse the repository at this point in the history
…ndows. (#24189)

Compare with blaze_util_posix.cc.

PiperOrigin-RevId: 692927012
Change-Id: Ibd7f44ec288c436e891157c82c1b5484c7e5c0f7
  • Loading branch information
tjgq authored Nov 4, 2024
1 parent d03942c commit 7a63c33
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/main/cpp/blaze_util_windows.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1106,17 +1106,19 @@ uint64_t AcquireLock(const blaze_util::Path& output_base, bool batch_mode,
}
if (GetLastError() == ERROR_SHARING_VIOLATION) {
// Someone else has the lock.
BAZEL_LOG(USER) << "Another command holds the client lock";
if (first_lock_attempt) {
first_lock_attempt = false;
BAZEL_LOG(USER) << "Another command holds the client lock.";
if (block) {
BAZEL_LOG(USER) << "Waiting for it to complete...";
}
fflush(stderr);
}
if (!block) {
BAZEL_DIE(blaze_exit_code::LOCK_HELD_NOBLOCK_FOR_LOCK)
<< "Exiting because the lock is held and --noblock_for_lock was "
"given.";
}
if (first_lock_attempt) {
first_lock_attempt = false;
BAZEL_LOG(USER) << "Waiting for it to complete...";
fflush(stderr);
}
Sleep(/* dwMilliseconds */ 200);
} else {
string err = GetLastErrorString();
Expand Down

0 comments on commit 7a63c33

Please sign in to comment.