[all-commits] [llvm/llvm-project] edff3f: [llvm][Support] Add ExponentialBackoff helper (#81...

Michael Spencer via All-commits all-commits at lists.llvm.org
Tue Feb 13 18:35:51 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: edff3ff4d37a9e051e33146393b064ce987af252
      https://github.com/llvm/llvm-project/commit/edff3ff4d37a9e051e33146393b064ce987af252
  Author: Michael Spencer <bigcheesegs at gmail.com>
  Date:   2024-02-13 (Tue, 13 Feb 2024)

  Changed paths:
    A llvm/include/llvm/Support/ExponentialBackoff.h
    M llvm/lib/Support/CMakeLists.txt
    A llvm/lib/Support/ExponentialBackoff.cpp
    M llvm/lib/Support/LockFileManager.cpp
    M llvm/unittests/Support/CMakeLists.txt
    A llvm/unittests/Support/ExponentialBackoffTest.cpp

  Log Message:
  -----------
  [llvm][Support] Add ExponentialBackoff helper (#81206)

This provides a simple way to implement exponential backoff using a do
while loop.

Usage example (also see the change to LockFileManager.cpp):
```
ExponentialBackoff Backoff(10s);
do {
  if (tryToDoSomething())
    return ItWorked;
} while (Backoff.waitForNextAttempt());
return Timeout;
```

Abstracting this out of `LockFileManager` as the module build daemon
will need it.




More information about the All-commits mailing list