clang-tools 20.0.0git
Public Types | Public Member Functions | List of all members
clang::clangd::PreambleThrottler Class Referenceabstract

PreambleThrottler controls which preambles can build at any given time. More...

#include <TUScheduler.h>

Public Types

using RequestID = unsigned
 
using Callback = llvm::unique_function< void()>
 

Public Member Functions

virtual ~PreambleThrottler ()=default
 
virtual RequestID acquire (llvm::StringRef Filename, Callback)=0
 Attempt to acquire resources to build a file's preamble.
 
virtual void release (RequestID)=0
 Abandons the request/releases any resources that have been acquired.
 

Detailed Description

PreambleThrottler controls which preambles can build at any given time.

This can be used to limit overall concurrency, and to prioritize some preambles over others. In a distributed environment, a throttler may be able to coordinate resource use across several clangd instances.

This class is threadsafe.

Definition at line 98 of file TUScheduler.h.

Member Typedef Documentation

◆ Callback

using clang::clangd::PreambleThrottler::Callback = llvm::unique_function<void()>

Definition at line 103 of file TUScheduler.h.

◆ RequestID

Definition at line 102 of file TUScheduler.h.

Constructor & Destructor Documentation

◆ ~PreambleThrottler()

virtual clang::clangd::PreambleThrottler::~PreambleThrottler ( )
virtualdefault

Member Function Documentation

◆ acquire()

virtual RequestID clang::clangd::PreambleThrottler::acquire ( llvm::StringRef  Filename,
Callback   
)
pure virtual

Attempt to acquire resources to build a file's preamble.

Does not block, may eventually invoke the callback to satisfy the request. If the callback is invoked, release() must be called afterwards.

◆ release()

virtual void clang::clangd::PreambleThrottler::release ( RequestID  )
pure virtual

Abandons the request/releases any resources that have been acquired.

Must be called exactly once after acquire(). acquire()'s callback will not be invoked after release() returns.


The documentation for this class was generated from the following file: