[lldb] Make StatsDuration thread-safe
std::chrono::duration types are not thread-safe, and they cannot be concurrently updated from multiple threads. Currently, we were doing such a thing (only) in the DWARF indexing code (DWARFUnit::ExtractDIEsRWLocked), but I think it can easily happen that someone else tries to update another statistic like this without bothering to check for thread safety. This patch changes the StatsDuration type from a simple typedef into a class in its own right. The class stores the duration internally as std::atomic<uint64_t> (so it can be updated atomically), but presents it to its users as the usual chrono type (duration<float>). Differential Revision: https://reviews.llvm.org/D117474
Loading
Please sign in to comment