diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2019-08-26 16:03:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-26 16:03:50 +0200 |
commit | 5558305ed4b9003af9700971b71b297ff68ad7a6 (patch) | |
tree | b8f8f92bc7b42e495d3f65ae1685874695cfeb8f /vespalib | |
parent | df496aa25aa4de10683bc28d2d3a706ee036f24b (diff) | |
parent | 1a8bb7c6ab57373d1fe33a56ffc1165bd358398c (diff) |
Merge pull request #10401 from vespa-engine/balder/avoid-sync-on-shared-executor
Balder/avoid sync on shared executor
Diffstat (limited to 'vespalib')
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 |