[PATCH] D90747: [clangd] Mark AsyncTaskRunner::runAsync as const

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 9 12:28:22 PST 2020


kadircet added a comment.

In D90747#2379406 <https://reviews.llvm.org/D90747#2379406>, @sammccall wrote:

> AsyncTaskRunner is definitely threadsafe, but const doesn't exactly mean threadsafe...

Right, I was also trying to punt on the idea of "writes are synchronized" rather than promising threadsafety here.

> This might be OK or maybe we should put `mutable` at the callsite - can you show the real example?

Oops, sorry forgot to update the stack for this one. The usage is in https://reviews.llvm.org/D90750, line 86 of ProjectAware.cpp specifically.
We definitely can make the AsyncTaskRunner mutable there too, but I would feel bad about mutating a "mutable" member without holding a lock in general, hence this change.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D90747



More information about the cfe-commits mailing list