summaryrefslogtreecommitdiffstats
path: root/vespalib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2019-08-25 14:44:30 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2019-08-25 14:44:30 +0000
commit9ab8b114aacb9e54cc3f8f33600c4adb1a2cc755 (patch)
tree4b9ce403a4a4dda9b10ab902aae418c498b1e4ed /vespalib
parent27444d9fb3334411c033a135f7e9dffccb2087e7 (diff)
Split ThreadExecutor in syncable and not.
Diffstat (limited to 'vespalib')
-rw-r--r--vespalib/src/vespa/vespalib/util/threadexecutor.h18
-rw-r--r--vespalib/src/vespa/vespalib/util/threadstackexecutorbase.cpp4
-rw-r--r--vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h4
3 files changed, 16 insertions, 10 deletions
diff --git a/vespalib/src/vespa/vespalib/util/threadexecutor.h b/vespalib/src/vespa/vespalib/util/threadexecutor.h
index 158805288e9..2dcbb595bb3 100644
--- a/vespalib/src/vespa/vespalib/util/threadexecutor.h
+++ b/vespalib/src/vespa/vespalib/util/threadexecutor.h
@@ -2,16 +2,12 @@
#pragma once
-#include <vespa/vespalib/util/executor.h>
-#include <vespa/vespalib/util/syncable.h>
+#include "executor.h"
+#include "syncable.h"
namespace vespalib {
-/**
- * Can both execute and sync
- **/
-class ThreadExecutor : public Executor,
- public Syncable
+class ThreadExecutor : public Executor
{
public:
/**
@@ -21,5 +17,13 @@ public:
virtual size_t getNumThreads() const = 0;
};
+/**
+ * Can both execute and sync
+ **/
+class SyncableThreadExecutor : public ThreadExecutor, public Syncable
+{
+public:
+};
+
} // namespace vespalib
diff --git a/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.cpp b/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.cpp
index dfd835e0e8e..969b5e6f61e 100644
--- a/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.cpp
+++ b/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.cpp
@@ -135,7 +135,9 @@ ThreadStackExecutorBase::run()
ThreadStackExecutorBase::ThreadStackExecutorBase(uint32_t stackSize,
uint32_t taskLimit,
init_fun_t init_fun)
- : _pool(std::make_unique<FastOS_ThreadPool>(stackSize)),
+ : SyncableThreadExecutor(),
+ Runnable(),
+ _pool(std::make_unique<FastOS_ThreadPool>(stackSize)),
_monitor(),
_stats(),
_executorCompletion(),
diff --git a/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h b/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h
index 8ee08ed3929..21a6e9cabe0 100644
--- a/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h
+++ b/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h
@@ -32,7 +32,7 @@ namespace thread { struct ThreadInit; }
/**
* An executor service that executes tasks in multiple threads.
**/
-class ThreadStackExecutorBase : public ThreadExecutor,
+class ThreadStackExecutorBase : public SyncableThreadExecutor,
public Runnable
{
public:
@@ -238,7 +238,7 @@ public:
/**
* Will invoke shutdown then sync.
**/
- ~ThreadStackExecutorBase();
+ ~ThreadStackExecutorBase() override;
};
} // namespace vespalib