diff options
author | Håvard Pettersen <havardpe@oath.com> | 2019-12-10 10:58:33 +0000 |
---|---|---|
committer | Håvard Pettersen <havardpe@oath.com> | 2019-12-12 12:05:21 +0000 |
commit | 970fa07a1d8ae88dafd5ed35bf1f98fae46af0fb (patch) | |
tree | 01615c821781f3d87866ad5c9aa0bce46eabd84f /vespalib | |
parent | 2de75cc16ce069fd9b36994101e4dd76de693220 (diff) |
async concurrent llvm compilation
Diffstat (limited to 'vespalib')
-rw-r--r-- | vespalib/src/vespa/vespalib/util/threadstackexecutorbase.cpp | 7 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h | 6 |
2 files changed, 13 insertions, 0 deletions
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. * |