diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2024-03-15 09:35:38 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-15 09:35:38 -0700 |
commit | f01a32f5c58b199edf7cd1492a20578453852f0e (patch) | |
tree | 3f9f2fb19e1b8259818591ec93f28abed34d60d1 /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | 186565513c57cd625ea7afd7b33897adfed7e9f8 (diff) | |
download | llvm-f01a32f5c58b199edf7cd1492a20578453852f0e.zip llvm-f01a32f5c58b199edf7cd1492a20578453852f0e.tar.gz llvm-f01a32f5c58b199edf7cd1492a20578453852f0e.tar.bz2 |
[lldb] Add an Alarm class for coalescing progress reports (#85329)
The commit introduces a new, generic, Alarm class. The class lets you to
schedule functions (callbacks) that will execute after a predefined
timeout. Once scheduled, you can cancel and reset a callback, given the
timeout hasn't expired yet.
The alarm class worker thread that sleeps until the next timeout
expires. When the thread wakes up, it checks for all the callbacks that
have expired and calls them in order. Because the callback is called
from the worker thread, the only guarantee is that a callback is called
no sooner than the timeout. A long running callback could potentially
block the worker threads and delay other callbacks from getting called.
I intentionally kept the implementation as simple as possible while
addressing the needs for the use case of coalescing progress events as
discussed in [1]. If we want to rely on this somewhere else, we can
reassess whether we need to address this class' limitations.
[1] https://discourse.llvm.org/t/rfc-improve-lldb-progress-reporting/75717/
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions