[PATCH] D50502: [clangd] Initial cancellation mechanism for LSP requests.

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 14 10:38:01 PDT 2018


kadircet added inline comments.


================
Comment at: clangd/Cancellation.cpp:17
+namespace {
+static Key<std::shared_ptr<std::atomic<bool>>> CancellationTokenKey;
+} // namespace
----------------
ilya-biryukov wrote:
> Having a `shared_ptr` key in the Context can cause data races (e.g. if we copy it concurrently from multiple threads).
> I suggest we make `CancellationToken` move-only (i.e. disallow copies) and return `const CancellationToken&` when getting it from the context.
As talked offline, copying std::shared_ptr is thread safe.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D50502





More information about the cfe-commits mailing list