[PATCH] D90595: [clangd] Fix race in background index rebuild, where index could stay stale.

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 9 03:36:03 PST 2021


kadircet added inline comments.


================
Comment at: clang-tools-extra/clangd/unittests/BackgroundIndexTests.cpp:850
+        if (++IdleCount <= 2) {
+          Q.push(Task);
+          Q.push(Task);
----------------
kadircet wrote:
> as discussed offline there are no guarantees on these newly pushed tasks finishing before the `OnIdle`.
i suppose we can do something like:
- Count number of times `OnIdle` has been executed.
- Enqueue 2 more tasks with first `OnIdle`.
- Assert that `OnIdle` has run twice ? (once on initial idleness, and once after completing 2 newly introduced tasks)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D90595/new/

https://reviews.llvm.org/D90595



More information about the cfe-commits mailing list