From f31f8dffef680bef44e56d2c5e22900533ab272f Mon Sep 17 00:00:00 2001 From: Geir Storli Date: Tue, 15 Dec 2020 11:05:00 +0000 Subject: Add explorer for the ExecutorThreadingService used in a document database. --- vespalib/src/vespa/vespalib/util/threadexecutor.h | 5 +++++ vespalib/src/vespa/vespalib/util/threadstackexecutorbase.cpp | 7 +++++++ vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h | 2 ++ 3 files changed, 14 insertions(+) (limited to 'vespalib') diff --git a/vespalib/src/vespa/vespalib/util/threadexecutor.h b/vespalib/src/vespa/vespalib/util/threadexecutor.h index 61a5d9d5ac7..7d06007d7be 100644 --- a/vespalib/src/vespa/vespalib/util/threadexecutor.h +++ b/vespalib/src/vespa/vespalib/util/threadexecutor.h @@ -32,6 +32,11 @@ public: * Sets a new upper limit for accepted number of tasks. */ virtual void setTaskLimit(uint32_t taskLimit) = 0; + + /** + * Gets the limit for accepted number of tasks. + */ + virtual uint32_t getTaskLimit() const = 0; }; /** diff --git a/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.cpp b/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.cpp index 28ee2da2d8c..01546b80d66 100644 --- a/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.cpp +++ b/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.cpp @@ -174,6 +174,13 @@ ThreadStackExecutorBase::setTaskLimit(uint32_t taskLimit) internalSetTaskLimit(taskLimit); } +uint32_t +ThreadStackExecutorBase::getTaskLimit() const +{ + unique_lock guard(_lock); + return _taskLimit; +} + void ThreadStackExecutorBase::wakeup() { // Nothing to do here as workers are always attentive. diff --git a/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h b/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h index c86597ca153..c0653c19516 100644 --- a/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h +++ b/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h @@ -211,6 +211,8 @@ public: size_t getNumThreads() const override; void setTaskLimit(uint32_t taskLimit) override; + uint32_t getTaskLimit() const override; + void wakeup() override; /** -- cgit v1.2.3