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



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to