summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHåvard Pettersen <havardpe@oath.com>2022-01-17 13:14:15 +0000
committerHåvard Pettersen <havardpe@oath.com>2022-01-17 13:14:15 +0000
commit486133bbb789519403d9d0ecd1fa7449fab914e6 (patch)
tree71f30f9fdcfa0f40ea8d1aae30b315eadbf12b33
parent342645b389dbb5c4614cec116d7da6a95813a572 (diff)
must handle pending add before pending remove
to avoid thread tracker 'leak'
-rw-r--r--vespalib/src/vespa/vespalib/util/cpu_usage.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/vespalib/src/vespa/vespalib/util/cpu_usage.cpp b/vespalib/src/vespa/vespalib/util/cpu_usage.cpp
index 36e92b522b9..98ae95712a7 100644
--- a/vespalib/src/vespa/vespalib/util/cpu_usage.cpp
+++ b/vespalib/src/vespa/vespalib/util/cpu_usage.cpp
@@ -187,14 +187,14 @@ CpuUsage::remove_thread(ThreadTracker::SP tracker)
void
CpuUsage::handle_pending(const Guard &guard)
{
- for (auto &thread: _pending_remove) {
- do_remove_thread(guard, std::move(thread));
- }
- _pending_remove.clear();
for (auto &thread: _pending_add) {
do_add_thread(guard, std::move(thread));
}
_pending_add.clear();
+ for (auto &thread: _pending_remove) {
+ do_remove_thread(guard, std::move(thread));
+ }
+ _pending_remove.clear();
}
CpuUsage::TimedSample