[all-commits] [llvm/llvm-project] 3dbe47: [clangd] Use atomics instead of locks to track per...

Sam McCall via All-commits all-commits at lists.llvm.org
Tue Dec 22 13:37:24 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 3dbe471a260392ec63dda8deb2709160afc56dde
      https://github.com/llvm/llvm-project/commit/3dbe471a260392ec63dda8deb2709160afc56dde
  Author: Sam McCall <sam.mccall at gmail.com>
  Date:   2020-12-22 (Tue, 22 Dec 2020)

  Changed paths:
    M clang-tools-extra/clangd/ClangdLSPServer.cpp
    M clang-tools-extra/clangd/ClangdLSPServer.h
    M clang-tools-extra/clangd/support/Threading.cpp
    M clang-tools-extra/clangd/support/Threading.h
    M clang-tools-extra/clangd/unittests/support/ThreadingTests.cpp

  Log Message:
  -----------
  [clangd] Use atomics instead of locks to track periodic memory trimming

Instead of always locking/unlocking a contended mutex, we now do one atomic read
in the common case, and one read + one exchange if the timer has expried.

Also use this for memory profiling which has similar/compatible requirements.

Differential Revision: https://reviews.llvm.org/D93726




More information about the All-commits mailing list