From 970fa07a1d8ae88dafd5ed35bf1f98fae46af0fb Mon Sep 17 00:00:00 2001 From: HÃ¥vard Pettersen Date: Tue, 10 Dec 2019 10:58:33 +0000 Subject: async concurrent llvm compilation --- vespalib/src/vespa/vespalib/util/threadstackexecutorbase.cpp | 7 +++++++ vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h | 6 ++++++ 2 files changed, 13 insertions(+) (limited to 'vespalib') diff --git a/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.cpp b/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.cpp index 969b5e6f61e..e933477bfb9 100644 --- a/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.cpp +++ b/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.cpp @@ -177,6 +177,13 @@ ThreadStackExecutorBase::internalSetTaskLimit(uint32_t taskLimit) } } +size_t +ThreadStackExecutorBase::num_idle_workers() const +{ + LockGuard lock(_monitor); + return _workers.size(); +} + ThreadStackExecutorBase::Stats ThreadStackExecutorBase::getStats() { diff --git a/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h b/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h index 21a6e9cabe0..8718b04d2d3 100644 --- a/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h +++ b/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h @@ -198,6 +198,12 @@ protected: public: ThreadStackExecutorBase(const ThreadStackExecutorBase &) = delete; ThreadStackExecutorBase & operator = (const ThreadStackExecutorBase &) = delete; + + /** + * Returns the number of idle workers. This is mostly useful for testing. + **/ + size_t num_idle_workers() const; + /** * Observe and reset stats for this object. * -- cgit v1.2.3