[PATCH] D129100: [clangd] Support external throttler for preamble builds

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 4 17:41:32 PDT 2022


sammccall added a comment.

I wanted to send a first version out for feedback even if incomplete.
(I want to do more extensive tests, and likely we should think about having an in-tree throttler on by default)

To motivate the design:

- when attempting to acquire a slot, we want to wait on (acquired || shutting down).
- This means sharing a condition variable for both events, as we can't wait on multiple conditions.
- this leads to the callback-based model for PreambleThrottler, the callback lets us encapsulate the use of a shared CV in this way
- the acquire callback naturally accesses the PreambleThread, but it might have gone away concurrently. This is awkward to solve in a callback API.
- The chosen solution is to heap-allocate a small object that can own the state the callback needs to access


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129100



More information about the cfe-commits mailing list