summaryrefslogtreecommitdiffstats
path: root/vespalib
diff options
context:
space:
mode:
authorGeir Storli <geirst@verizonmedia.com>2020-12-15 11:05:00 +0000
committerGeir Storli <geirst@verizonmedia.com>2020-12-15 11:06:47 +0000
commitf31f8dffef680bef44e56d2c5e22900533ab272f (patch)
treedc72fbe4de83f8fbc235bda85a24f244e80a1ea8 /vespalib
parent6f479ad61a4a6d973ce6a985e25206e9adfdcfee (diff)
Add explorer for the ExecutorThreadingService used in a document database.
Diffstat (limited to 'vespalib')
-rw-r--r--vespalib/src/vespa/vespalib/util/threadexecutor.h5
-rw-r--r--vespalib/src/vespa/vespalib/util/threadstackexecutorbase.cpp7
-rw-r--r--vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h2
3 files changed, 14 insertions, 0 deletions
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;
/**