diff options
Diffstat (limited to 'vespalib')
3 files changed, 12 insertions, 1 deletions
diff --git a/vespalib/src/vespa/vespalib/util/threadexecutor.h b/vespalib/src/vespa/vespalib/util/threadexecutor.h index 3ec19ea9a71..c202a0a2373 100644 --- a/vespalib/src/vespa/vespalib/util/threadexecutor.h +++ b/vespalib/src/vespa/vespalib/util/threadexecutor.h @@ -15,6 +15,11 @@ class ThreadExecutor : public Executor, public Syncable { public: + /** + * Get number of threads in the executor pool. + * @return number of threads in the pool + */ + virtual size_t getNumThreads() const = 0; }; } // namespace vespalib diff --git a/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.cpp b/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.cpp index 76557762479..21d1de2a29b 100644 --- a/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.cpp +++ b/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.cpp @@ -155,6 +155,10 @@ ThreadStackExecutorBase::start(uint32_t threads) } } +size_t ThreadStackExecutorBase::getNumThreads() const { + return _pool->GetNumStartedThreads(); +} + void ThreadStackExecutorBase::internalSetTaskLimit(uint32_t taskLimit) { diff --git a/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h b/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h index 4ea27a2bcde..ee142659027 100644 --- a/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h +++ b/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h @@ -98,7 +98,7 @@ private: void unblock(); }; - std::unique_ptr<FastOS_ThreadPool> _pool; + std::unique_ptr<FastOS_ThreadPool> _pool; Monitor _monitor; Stats _stats; Gate _executorCompletion; @@ -223,6 +223,8 @@ public: **/ void wait_for_task_count(uint32_t task_count); + size_t getNumThreads() const override; + /** * Shut down this executor. This will make this executor reject * all new tasks. |