aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2025-10-07 12:45:45 -0700
committerGitHub <noreply@github.com>2025-10-07 12:45:45 -0700
commit605e2d1fdd26bc78b824a8b97c1f2eafbcbe5a54 (patch)
tree99f10193ec1a9259e8ad9a8d143e6342dd1a5fbd /clang/lib/Frontend/CompilerInvocation.cpp
parent7546bd38041612e8b768f4b315e491cd549d608c (diff)
downloadllvm-605e2d1fdd26bc78b824a8b97c1f2eafbcbe5a54.zip
llvm-605e2d1fdd26bc78b824a8b97c1f2eafbcbe5a54.tar.gz
llvm-605e2d1fdd26bc78b824a8b97c1f2eafbcbe5a54.tar.bz2
[lldb] Make MainLoopTest::CallbackWithTimeout slightly more resilient (#162197)
Compute the start time *before* registering the callback, rather than after, to avoid the possibility of a small race. The following scenario illustrates the problem. 1. The callback is registered with a 2 second timeout at t=0ms. 2. We compute the start time after registering the callback. For the sake of argument, let's say it took 5ms to return from registering the callback and computing the current time. Start=5ms. 3. The callback fires after exactly 2 seconds, or t=2000ms. 4. We compute the difference between start and now. If it took less than 5ms to compute, then we end up with a difference that's less than 2000ms and the test fails. Let's say it took 3ms this time, then 2003ms-5ms=1998ms < 2000ms. The actual values in the example above are arbitrary. All that matters is that it took longer to compute the start time than the end time. My theory is that this explains why this test is flaky when running under ASan in CI (which has unpredictable timing). rdar://160956999
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions