[PATCH] D54746: [clangd] Respect task cancellation in TUScheduler.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 20 02:53:03 PST 2018


sammccall created this revision.
sammccall added a reviewer: ilya-biryukov.
Herald added subscribers: cfe-commits, kadircet, arphaman, jkorous, MaskRay, ioeric, javed.absar.

- Reads are never executed if canceled before ready-to run. In practice, we finalize cancelled reads eagerly and out-of-order.
- Cancelled reads don't prevent prior updates from being elided, as they don't actually depend on the result of the update.
- Updates are downgraded from WantDiagnostics::Yes to WantDiagnostics::Auto when cancelled, which allows them to be elided when all dependent reads are cancelled and there are subsequent writes. (e.g. when the queue is backed up with cancelled requests).

The queue operations aren't optimal (we scan the whole queue for cancelled
tasks every time the scheduler runs, and check cancellation twice in the end).
However I believe these costs are still trivial in practice (compared to any
AST operation) and the logic can be cleanly separated from the rest of the
scheduler.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D54746

Files:
  clangd/Cancellation.cpp
  clangd/Cancellation.h
  clangd/TUScheduler.cpp
  clangd/TUScheduler.h
  unittests/clangd/TUSchedulerTests.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54746.174738.patch
Type: text/x-patch
Size: 7346 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181120/37a5a83b/attachment-0001.bin>


More information about the cfe-commits mailing list