summaryrefslogtreecommitdiffstats
path: root/vespalib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-12-19 16:06:16 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2022-12-20 05:10:52 +0000
commita00e560b0d8267e9b376e5c0e6a2139a7be63281 (patch)
treeba207915b8cac9fb92493cc103821f6cce9db31b /vespalib
parent05b58ac83b06b00ae97ecafad101e44d4dd76aee (diff)
Remove stacksize from the thread pools and thread executors.
Diffstat (limited to 'vespalib')
-rw-r--r--vespalib/src/tests/btree/btree-stress/btree_stress_test.cpp8
-rw-r--r--vespalib/src/tests/clock/clock_benchmark.cpp2
-rw-r--r--vespalib/src/tests/coro/lazy/lazy_test.cpp15
-rw-r--r--vespalib/src/tests/datastore/sharded_hash_map/sharded_hash_map_test.cpp4
-rw-r--r--vespalib/src/tests/executor/blocking_executor_stress.cpp2
-rw-r--r--vespalib/src/tests/executor/blockingthreadstackexecutor_test.cpp8
-rw-r--r--vespalib/src/tests/executor/stress_test.cpp2
-rw-r--r--vespalib/src/tests/executor/threadstackexecutor_test.cpp10
-rw-r--r--vespalib/src/tests/util/generationhandler_stress/generation_handler_stress_test.cpp4
-rw-r--r--vespalib/src/tests/util/rcuvector/rcuvector_test.cpp4
-rw-r--r--vespalib/src/vespa/vespalib/net/async_resolver.cpp2
-rw-r--r--vespalib/src/vespa/vespalib/testkit/test_hook.cpp2
-rw-r--r--vespalib/src/vespa/vespalib/util/adaptive_sequenced_executor.cpp2
-rw-r--r--vespalib/src/vespa/vespalib/util/blockingthreadstackexecutor.cpp8
-rw-r--r--vespalib/src/vespa/vespalib/util/blockingthreadstackexecutor.h9
-rw-r--r--vespalib/src/vespa/vespalib/util/sequencedtaskexecutor.cpp5
-rw-r--r--vespalib/src/vespa/vespalib/util/shutdownguard.cpp2
-rw-r--r--vespalib/src/vespa/vespalib/util/thread.cpp2
-rw-r--r--vespalib/src/vespa/vespalib/util/threadstackexecutor.cpp18
-rw-r--r--vespalib/src/vespa/vespalib/util/threadstackexecutor.h14
-rw-r--r--vespalib/src/vespa/vespalib/util/threadstackexecutorbase.cpp6
-rw-r--r--vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h4
22 files changed, 60 insertions, 73 deletions
diff --git a/vespalib/src/tests/btree/btree-stress/btree_stress_test.cpp b/vespalib/src/tests/btree/btree-stress/btree_stress_test.cpp
index cf809e0d730..2993bae90c4 100644
--- a/vespalib/src/tests/btree/btree-stress/btree_stress_test.cpp
+++ b/vespalib/src/tests/btree/btree-stress/btree_stress_test.cpp
@@ -1,15 +1,11 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/vespalib/btree/btree.h>
-#include <vespa/vespalib/btree/btreebuilder.h>
#include <vespa/vespalib/btree/btreenodeallocator.h>
-#include <vespa/vespalib/btree/btreeroot.h>
-#include <vespa/vespalib/btree/btreestore.h>
#include <vespa/vespalib/gtest/gtest.h>
#include <vespa/vespalib/util/lambdatask.h>
#include <vespa/vespalib/util/rand48.h>
-#include <vespa/vespalib/util/size_literals.h>
#include <vespa/vespalib/util/threadstackexecutor.h>
#include <vespa/vespalib/btree/btreenodeallocator.hpp>
@@ -235,8 +231,8 @@ Fixture<Params>::Fixture()
_generationHandler(),
_tree(),
_writeItr(_tree.begin()),
- _writer(1, 128_Ki),
- _readers(4, 128_Ki),
+ _writer(1),
+ _readers(4),
_rnd(),
_keyLimit(1000000),
_readSeed(50),
diff --git a/vespalib/src/tests/clock/clock_benchmark.cpp b/vespalib/src/tests/clock/clock_benchmark.cpp
index 249add4bc1a..a21ad2b05ef 100644
--- a/vespalib/src/tests/clock/clock_benchmark.cpp
+++ b/vespalib/src/tests/clock/clock_benchmark.cpp
@@ -134,7 +134,7 @@ main(int , char *argv[])
uint64_t frequency = atoll(argv[1]);
uint32_t numThreads = atoi(argv[2]);
uint64_t samples = atoll(argv[3]);
- FastOS_ThreadPool pool(0x10000);
+ FastOS_ThreadPool pool;
NSValue nsValue;
NSVolatile nsVolatile;
NSAtomic nsAtomic;
diff --git a/vespalib/src/tests/coro/lazy/lazy_test.cpp b/vespalib/src/tests/coro/lazy/lazy_test.cpp
index 29aac4440fc..f6767873957 100644
--- a/vespalib/src/tests/coro/lazy/lazy_test.cpp
+++ b/vespalib/src/tests/coro/lazy/lazy_test.cpp
@@ -3,7 +3,6 @@
#include <vespa/vespalib/coro/lazy.h>
#include <vespa/vespalib/coro/completion.h>
#include <vespa/vespalib/coro/schedule.h>
-#include <vespa/vespalib/util/size_literals.h>
#include <vespa/vespalib/util/require.h>
#include <vespa/vespalib/util/gate.h>
#include <vespa/vespalib/util/threadstackexecutor.h>
@@ -102,7 +101,7 @@ TEST(LazyTest, extract_rvalue_from_lazy_in_sync_wait) {
}
TEST(LazyTest, calculate_result_in_another_thread) {
- vespalib::ThreadStackExecutor executor(1, 128_Ki);
+ vespalib::ThreadStackExecutor executor(1);
auto result = sync_wait(try_schedule_on(executor, make_lazy(7)));
EXPECT_EQ(result.first, true);
EXPECT_EQ(result.second, 7);
@@ -111,13 +110,13 @@ TEST(LazyTest, calculate_result_in_another_thread) {
}
TEST(LazyTest, exceptions_are_propagated) {
- vespalib::ThreadStackExecutor executor(1, 128_Ki);
+ vespalib::ThreadStackExecutor executor(1);
auto lazy = try_schedule_on(executor, forward_value(will_throw()));
EXPECT_THROW(sync_wait(std::move(lazy)), vespalib::RequireFailedException);
}
TEST(LazyTest, not_able_to_switch_thread_if_executor_is_shut_down) {
- vespalib::ThreadStackExecutor executor(1, 128_Ki);
+ vespalib::ThreadStackExecutor executor(1);
executor.shutdown();
auto result = sync_wait(try_schedule_on(executor, make_lazy(7)));
EXPECT_EQ(result.first, false);
@@ -129,7 +128,7 @@ TEST(LazyTest, not_able_to_switch_thread_if_executor_is_shut_down) {
TEST(LazyTest, async_wait_with_lambda) {
Gate gate;
Received<int> result;
- vespalib::ThreadStackExecutor executor(1, 128_Ki);
+ vespalib::ThreadStackExecutor executor(1);
auto lazy = schedule_on(executor, make_lazy(7));
async_wait(std::move(lazy), [&](auto res)
{
@@ -143,7 +142,7 @@ TEST(LazyTest, async_wait_with_lambda) {
TEST(LazyTest, async_wait_with_error) {
Gate gate;
Received<int> result;
- vespalib::ThreadStackExecutor executor(1, 128_Ki);
+ vespalib::ThreadStackExecutor executor(1);
auto lazy = schedule_on(executor, will_throw());
async_wait(std::move(lazy), [&](auto res)
{
@@ -157,7 +156,7 @@ TEST(LazyTest, async_wait_with_error) {
TEST(LazyTest, async_wait_with_move_only_result) {
Gate gate;
Received<std::unique_ptr<int>> result;
- vespalib::ThreadStackExecutor executor(1, 128_Ki);
+ vespalib::ThreadStackExecutor executor(1);
auto lazy = schedule_on(executor, move_only_int());
async_wait(std::move(lazy), [&](auto res)
{
@@ -178,7 +177,7 @@ struct Refs {
TEST(LazyTest, async_wait_with_move_only_result_and_move_only_lambda) {
Gate gate;
Received<std::unique_ptr<int>> result;
- vespalib::ThreadStackExecutor executor(1, 128_Ki);
+ vespalib::ThreadStackExecutor executor(1);
auto lazy = schedule_on(executor, move_only_int());
async_wait(std::move(lazy), [refs = std::make_unique<Refs>(gate,result)](auto res)
{
diff --git a/vespalib/src/tests/datastore/sharded_hash_map/sharded_hash_map_test.cpp b/vespalib/src/tests/datastore/sharded_hash_map/sharded_hash_map_test.cpp
index 4c3fe1756c5..eec3a6e6188 100644
--- a/vespalib/src/tests/datastore/sharded_hash_map/sharded_hash_map_test.cpp
+++ b/vespalib/src/tests/datastore/sharded_hash_map/sharded_hash_map_test.cpp
@@ -135,8 +135,8 @@ DataStoreShardedHashTest::DataStoreShardedHashTest()
_allocator({}),
_store(_allocator.get_data_store()),
_hash_map(std::make_unique<MyCompare>(_store)),
- _writer(1, 128_Ki),
- _readers(4, 128_Ki),
+ _writer(1),
+ _readers(4),
_rnd(),
_keyLimit(1000000),
_read_seed(50),
diff --git a/vespalib/src/tests/executor/blocking_executor_stress.cpp b/vespalib/src/tests/executor/blocking_executor_stress.cpp
index 7292e374559..870c8cee920 100644
--- a/vespalib/src/tests/executor/blocking_executor_stress.cpp
+++ b/vespalib/src/tests/executor/blocking_executor_stress.cpp
@@ -33,7 +33,7 @@ struct MyTask : Executor::Task {
}
};
-TEST_MT_F("stress test block thread stack executor", 8, BlockingThreadStackExecutor(4, 128000, 1000))
+TEST_MT_F("stress test block thread stack executor", 8, BlockingThreadStackExecutor(4, 1000))
{
size_t loop_cnt = 100;
for (size_t i = 0; i < loop_cnt; ++i) {
diff --git a/vespalib/src/tests/executor/blockingthreadstackexecutor_test.cpp b/vespalib/src/tests/executor/blockingthreadstackexecutor_test.cpp
index d811ded9e95..8342257f3e7 100644
--- a/vespalib/src/tests/executor/blockingthreadstackexecutor_test.cpp
+++ b/vespalib/src/tests/executor/blockingthreadstackexecutor_test.cpp
@@ -48,7 +48,7 @@ struct Fixture
Gate blockedExecuteGate;
Fixture(uint32_t taskLimit, uint32_t tasksToWaitFor)
- : executor(1, 128000, taskLimit),
+ : executor(1, taskLimit),
workersEntryGate(),
workersExitLatch(tasksToWaitFor),
blockedExecuteGate()
@@ -123,14 +123,14 @@ vespalib::string get_worker_stack_trace(BlockingThreadStackExecutor &executor) {
VESPA_THREAD_STACK_TAG(my_stack_tag);
-TEST_F("require that executor has appropriate default thread stack tag", BlockingThreadStackExecutor(1, 128_Ki, 10)) {
+TEST_F("require that executor has appropriate default thread stack tag", BlockingThreadStackExecutor(1, 10)) {
vespalib::string trace = get_worker_stack_trace(f1);
if (!EXPECT_TRUE(trace.find("unnamed_blocking_executor") != vespalib::string::npos)) {
fprintf(stderr, "%s\n", trace.c_str());
}
}
-TEST_F("require that executor thread stack tag can be set", BlockingThreadStackExecutor(1, 128_Ki, 10, my_stack_tag)) {
+TEST_F("require that executor thread stack tag can be set", BlockingThreadStackExecutor(1, 10, my_stack_tag)) {
vespalib::string trace = get_worker_stack_trace(f1);
if (!EXPECT_TRUE(trace.find("my_stack_tag") != vespalib::string::npos)) {
fprintf(stderr, "%s\n", trace.c_str());
@@ -140,7 +140,7 @@ TEST_F("require that executor thread stack tag can be set", BlockingThreadStackE
TEST_F("require that tasks posted from internal worker thread will not block executor", TimeBomb(60)) {
size_t cnt = 0;
Gate fork_done;
- BlockingThreadStackExecutor executor(1, 128_Ki, 10);
+ BlockingThreadStackExecutor executor(1, 10);
struct IncTask : Executor::Task {
size_t &cnt;
IncTask(size_t &cnt_in) : cnt(cnt_in) {}
diff --git a/vespalib/src/tests/executor/stress_test.cpp b/vespalib/src/tests/executor/stress_test.cpp
index 869cc05fa4b..923b7eea3a5 100644
--- a/vespalib/src/tests/executor/stress_test.cpp
+++ b/vespalib/src/tests/executor/stress_test.cpp
@@ -105,7 +105,7 @@ Test::Main()
fprintf(stderr, "calibrating task size...\n");
uint32_t taskSize = calibrate(ms_per_task);
fprintf(stderr, "calibrated task size: %u\n", taskSize);
- ThreadStackExecutor executor(threads, 128000, 5000 + threads);
+ ThreadStackExecutor executor(threads, 5000 + threads);
{
Gate gate;
CountDownLatch latch(threads);
diff --git a/vespalib/src/tests/executor/threadstackexecutor_test.cpp b/vespalib/src/tests/executor/threadstackexecutor_test.cpp
index 688d98ff032..7d77e224fe5 100644
--- a/vespalib/src/tests/executor/threadstackexecutor_test.cpp
+++ b/vespalib/src/tests/executor/threadstackexecutor_test.cpp
@@ -39,7 +39,7 @@ struct MyState {
CountDownLatch latch; // to wait for workers
ThreadStackExecutor executor;
bool checked;
- MyState() : gate(), latch(10), executor(NUM_THREADS, 128000, 20), checked(false)
+ MyState() : gate(), latch(10), executor(NUM_THREADS, 20), checked(false)
{
MyTask::resetStats();
}
@@ -132,7 +132,7 @@ struct WaitState {
std::vector<Gate> block_task;
std::vector<Gate> wait_done;
WaitState(size_t num_threads)
- : executor(num_threads / 2, 128000), block_task(num_threads - 2), wait_done(num_threads - 1)
+ : executor(num_threads / 2), block_task(num_threads - 2), wait_done(num_threads - 1)
{
for (auto &gate: block_task) {
auto result = executor.execute(std::make_unique<WaitTask>(gate));
@@ -175,14 +175,14 @@ vespalib::string get_worker_stack_trace(ThreadStackExecutor &executor) {
VESPA_THREAD_STACK_TAG(my_stack_tag);
-TEST_F("require that executor has appropriate default thread stack tag", ThreadStackExecutor(1, 128_Ki)) {
+TEST_F("require that executor has appropriate default thread stack tag", ThreadStackExecutor(1)) {
vespalib::string trace = get_worker_stack_trace(f1);
if (!EXPECT_TRUE(trace.find("unnamed_nonblocking_executor") != vespalib::string::npos)) {
fprintf(stderr, "%s\n", trace.c_str());
}
}
-TEST_F("require that executor thread stack tag can be set", ThreadStackExecutor(1, 128_Ki, my_stack_tag)) {
+TEST_F("require that executor thread stack tag can be set", ThreadStackExecutor(1, my_stack_tag)) {
vespalib::string trace = get_worker_stack_trace(f1);
if (!EXPECT_TRUE(trace.find("my_stack_tag") != vespalib::string::npos)) {
fprintf(stderr, "%s\n", trace.c_str());
@@ -215,7 +215,7 @@ TEST("require that stats can be accumulated") {
}
TEST("Test that utilization is computed") {
- ThreadStackExecutor executor(1, 128_Ki);
+ ThreadStackExecutor executor(1);
std::this_thread::sleep_for(1s);
auto stats = executor.getStats();
EXPECT_GREATER(0.50, stats.getUtil());
diff --git a/vespalib/src/tests/util/generationhandler_stress/generation_handler_stress_test.cpp b/vespalib/src/tests/util/generationhandler_stress/generation_handler_stress_test.cpp
index fd2769fd8b1..1cc54da7f2e 100644
--- a/vespalib/src/tests/util/generationhandler_stress/generation_handler_stress_test.cpp
+++ b/vespalib/src/tests/util/generationhandler_stress/generation_handler_stress_test.cpp
@@ -97,7 +97,7 @@ Fixture::Fixture()
: ::testing::Test(),
_generationHandler(),
_readThreads(1),
- _writer(1, 128_Ki),
+ _writer(1),
_readers(),
_doneWriteWork(0),
_doneReadWork(0),
@@ -131,7 +131,7 @@ Fixture::set_read_threads(uint32_t read_threads)
_readers->shutdown();
}
_readThreads = read_threads;
- _readers = std::make_unique<ThreadStackExecutor>(read_threads, 128_Ki);
+ _readers = std::make_unique<ThreadStackExecutor>(read_threads);
}
void
diff --git a/vespalib/src/tests/util/rcuvector/rcuvector_test.cpp b/vespalib/src/tests/util/rcuvector/rcuvector_test.cpp
index 5d6ec3050da..b842d009ce8 100644
--- a/vespalib/src/tests/util/rcuvector/rcuvector_test.cpp
+++ b/vespalib/src/tests/util/rcuvector/rcuvector_test.cpp
@@ -420,8 +420,8 @@ StressFixture::StressFixture()
stop_read(false),
read_area(1000),
generation_handler(),
- writer(1, 128_Ki),
- readers(4, 128_Ki)
+ writer(1),
+ readers(4)
{
arr.ensure_size(read_area, AtomicIntWrapper(0));
}
diff --git a/vespalib/src/vespa/vespalib/net/async_resolver.cpp b/vespalib/src/vespa/vespalib/net/async_resolver.cpp
index 7eab9d7c13c..bc0a2cc8085 100644
--- a/vespalib/src/vespa/vespalib/net/async_resolver.cpp
+++ b/vespalib/src/vespa/vespalib/net/async_resolver.cpp
@@ -151,7 +151,7 @@ AsyncResolver::SP AsyncResolver::_shared_resolver(nullptr);
AsyncResolver::AsyncResolver(HostResolver::SP resolver, size_t num_threads)
: _resolver(std::move(resolver)),
- _executor(std::make_unique<ThreadStackExecutor>(num_threads, 128_Ki, async_resolver_executor_thread))
+ _executor(std::make_unique<ThreadStackExecutor>(num_threads, async_resolver_executor_thread))
{
}
diff --git a/vespalib/src/vespa/vespalib/testkit/test_hook.cpp b/vespalib/src/vespa/vespalib/testkit/test_hook.cpp
index 109f70bd2ad..4e33897d869 100644
--- a/vespalib/src/vespa/vespalib/testkit/test_hook.cpp
+++ b/vespalib/src/vespa/vespalib/testkit/test_hook.cpp
@@ -19,7 +19,7 @@ struct FastOSTestThreadRunner : FastOS_Runnable {
struct FastOSTestThreadFactory : TestThreadFactory {
FastOS_ThreadPool threadPool;
- FastOSTestThreadFactory() : threadPool(256_Ki) {}
+ FastOSTestThreadFactory() : threadPool() {}
void createThread(TestThreadEntry &entry) override {
threadPool.NewThread(new FastOSTestThreadRunner(entry), 0);
}
diff --git a/vespalib/src/vespa/vespalib/util/adaptive_sequenced_executor.cpp b/vespalib/src/vespa/vespalib/util/adaptive_sequenced_executor.cpp
index e7f43de8f92..14a235f7257 100644
--- a/vespalib/src/vespa/vespalib/util/adaptive_sequenced_executor.cpp
+++ b/vespalib/src/vespa/vespalib/util/adaptive_sequenced_executor.cpp
@@ -54,7 +54,7 @@ AdaptiveSequencedExecutor::Self::~Self()
AdaptiveSequencedExecutor::ThreadTools::ThreadTools(AdaptiveSequencedExecutor &parent_in)
: parent(parent_in),
- pool(std::make_unique<FastOS_ThreadPool>(STACK_SIZE)),
+ pool(std::make_unique<FastOS_ThreadPool>()),
allow_worker_exit()
{
}
diff --git a/vespalib/src/vespa/vespalib/util/blockingthreadstackexecutor.cpp b/vespalib/src/vespa/vespalib/util/blockingthreadstackexecutor.cpp
index a80af57d900..f40390bbf83 100644
--- a/vespalib/src/vespa/vespalib/util/blockingthreadstackexecutor.cpp
+++ b/vespalib/src/vespa/vespalib/util/blockingthreadstackexecutor.cpp
@@ -21,15 +21,15 @@ BlockingThreadStackExecutor::wakeup(unique_lock &, std::condition_variable & con
cond.notify_all();
}
-BlockingThreadStackExecutor::BlockingThreadStackExecutor(uint32_t threads, uint32_t stackSize, uint32_t taskLimit)
- : ThreadStackExecutorBase(stackSize, taskLimit, unnamed_blocking_executor)
+BlockingThreadStackExecutor::BlockingThreadStackExecutor(uint32_t threads, uint32_t taskLimit)
+ : ThreadStackExecutorBase(taskLimit, unnamed_blocking_executor)
{
start(threads);
}
-BlockingThreadStackExecutor::BlockingThreadStackExecutor(uint32_t threads, uint32_t stackSize, uint32_t taskLimit,
+BlockingThreadStackExecutor::BlockingThreadStackExecutor(uint32_t threads, uint32_t taskLimit,
init_fun_t init_function)
- : ThreadStackExecutorBase(stackSize, taskLimit, std::move(init_function))
+ : ThreadStackExecutorBase(taskLimit, std::move(init_function))
{
start(threads);
}
diff --git a/vespalib/src/vespa/vespalib/util/blockingthreadstackexecutor.h b/vespalib/src/vespa/vespalib/util/blockingthreadstackexecutor.h
index 7a095f8c70a..7d2791aa068 100644
--- a/vespalib/src/vespa/vespalib/util/blockingthreadstackexecutor.h
+++ b/vespalib/src/vespa/vespalib/util/blockingthreadstackexecutor.h
@@ -11,26 +11,23 @@ namespace vespalib {
**/
class BlockingThreadStackExecutor : public ThreadStackExecutorBase
{
-private:
+public:
bool acceptNewTask(unique_lock & guard, std::condition_variable & cond) override;
void wakeup(unique_lock & guard, std::condition_variable &) override;
-public:
/**
* Create a new blocking thread stack executor. The task limit specifies
* the maximum number of tasks that are currently handled by this
* executor. Trying to execute more tasks will block.
*
* @param threads number of worker threads (concurrent tasks)
- * @param stackSize stack size per worker thread
* @param taskLimit upper limit on accepted tasks
**/
- BlockingThreadStackExecutor(uint32_t threads, uint32_t stackSize, uint32_t taskLimit);
+ BlockingThreadStackExecutor(uint32_t threads, uint32_t taskLimit);
// same as above, but enables you to specify a custom function
// used to wrap the main loop of all worker threads
- BlockingThreadStackExecutor(uint32_t threads, uint32_t stackSize, uint32_t taskLimit,
- init_fun_t init_function);
+ BlockingThreadStackExecutor(uint32_t threads, uint32_t taskLimit, init_fun_t init_function);
~BlockingThreadStackExecutor() override;
};
diff --git a/vespalib/src/vespa/vespalib/util/sequencedtaskexecutor.cpp b/vespalib/src/vespa/vespalib/util/sequencedtaskexecutor.cpp
index e12d2065d9f..7538e2acb50 100644
--- a/vespalib/src/vespa/vespalib/util/sequencedtaskexecutor.cpp
+++ b/vespalib/src/vespa/vespalib/util/sequencedtaskexecutor.cpp
@@ -14,7 +14,6 @@ namespace vespalib {
namespace {
-constexpr uint32_t stackSize = 128_Ki;
constexpr uint8_t MAGIC = 255;
constexpr uint32_t NUM_PERFECT_PER_EXECUTOR = 8;
constexpr uint16_t INVALID_KEY = 0x8000;
@@ -77,9 +76,9 @@ SequencedTaskExecutor::create(Runnable::init_fun_t func, uint32_t threads, uint3
executors.push_back(std::make_unique<SingleExecutor>(func, taskLimit, is_task_limit_hard, watermark, 100ms));
} else {
if (is_task_limit_hard) {
- executors.push_back(std::make_unique<BlockingThreadStackExecutor>(1, stackSize, taskLimit, func));
+ executors.push_back(std::make_unique<BlockingThreadStackExecutor>(1, taskLimit, func));
} else {
- executors.push_back(std::make_unique<ThreadStackExecutor>(1, stackSize, func));
+ executors.push_back(std::make_unique<ThreadStackExecutor>(1, func));
}
}
}
diff --git a/vespalib/src/vespa/vespalib/util/shutdownguard.cpp b/vespalib/src/vespa/vespalib/util/shutdownguard.cpp
index 12e58898c06..e3e56dc78cb 100644
--- a/vespalib/src/vespa/vespalib/util/shutdownguard.cpp
+++ b/vespalib/src/vespa/vespalib/util/shutdownguard.cpp
@@ -24,7 +24,7 @@ void ShutdownGuard::Run(FastOS_ThreadInterface *, void *)
ShutdownGuard::ShutdownGuard(duration millis) :
FastOS_Runnable(),
- _pool(STACK_SIZE, 1),
+ _pool(1),
_dieAtTime(steady_clock::now() + millis)
{
_pool.NewThread(this);
diff --git a/vespalib/src/vespa/vespalib/util/thread.cpp b/vespalib/src/vespa/vespalib/util/thread.cpp
index ffa9f385967..82ba441420d 100644
--- a/vespalib/src/vespa/vespalib/util/thread.cpp
+++ b/vespalib/src/vespa/vespalib/util/thread.cpp
@@ -32,7 +32,7 @@ Thread::Proxy::~Proxy() = default;
Thread::Thread(Runnable &runnable, init_fun_t init_fun_in)
: _proxy(*this, runnable, std::move(init_fun_in)),
- _pool(STACK_SIZE, 1),
+ _pool(1),
_lock(),
_cond(),
_stopped(false),
diff --git a/vespalib/src/vespa/vespalib/util/threadstackexecutor.cpp b/vespalib/src/vespa/vespalib/util/threadstackexecutor.cpp
index a975db04a2e..9ca6c643d75 100644
--- a/vespalib/src/vespa/vespalib/util/threadstackexecutor.cpp
+++ b/vespalib/src/vespa/vespalib/util/threadstackexecutor.cpp
@@ -17,16 +17,22 @@ ThreadStackExecutor::wakeup(unique_lock &, std::condition_variable &)
{
}
-ThreadStackExecutor::ThreadStackExecutor(uint32_t threads, uint32_t stackSize,
- uint32_t taskLimit)
- : ThreadStackExecutorBase(stackSize, taskLimit, unnamed_nonblocking_executor)
+ThreadStackExecutor::ThreadStackExecutor(uint32_t threads)
+ : ThreadStackExecutor(threads, unnamed_nonblocking_executor)
+{ }
+
+ThreadStackExecutor::ThreadStackExecutor(uint32_t threads, uint32_t taskLimit)
+ : ThreadStackExecutorBase(taskLimit, unnamed_nonblocking_executor)
{
start(threads);
}
-ThreadStackExecutor::ThreadStackExecutor(uint32_t threads, uint32_t stackSize,
- init_fun_t init_function, uint32_t taskLimit)
- : ThreadStackExecutorBase(stackSize, taskLimit, std::move(init_function))
+ThreadStackExecutor::ThreadStackExecutor(uint32_t threads, init_fun_t init_function)
+ : ThreadStackExecutor(threads, std::move(init_function), 0xffffffff)
+{ }
+
+ThreadStackExecutor::ThreadStackExecutor(uint32_t threads, init_fun_t init_function, uint32_t taskLimit)
+ : ThreadStackExecutorBase(taskLimit, std::move(init_function))
{
start(threads);
}
diff --git a/vespalib/src/vespa/vespalib/util/threadstackexecutor.h b/vespalib/src/vespa/vespalib/util/threadstackexecutor.h
index 687ecfbac0b..9011799ece4 100644
--- a/vespalib/src/vespa/vespalib/util/threadstackexecutor.h
+++ b/vespalib/src/vespa/vespalib/util/threadstackexecutor.h
@@ -15,7 +15,6 @@ public:
bool acceptNewTask(unique_lock &, std::condition_variable &) override;
void wakeup(unique_lock &, std::condition_variable &) override;
-public:
/**
* Create a new thread stack executor. The task limit specifies
* the maximum number of tasks that are currently handled by this
@@ -23,21 +22,16 @@ public:
* greater than 0.
*
* @param threads number of worker threads (concurrent tasks)
- * @param stackSize stack size per worker thread
* @param taskLimit upper limit on accepted tasks
**/
- ThreadStackExecutor(uint32_t threads, uint32_t stackSize,
- uint32_t taskLimit = 0xffffffff);
+ ThreadStackExecutor(uint32_t threads, uint32_t taskLimit);
+ ThreadStackExecutor(uint32_t threads);
// same as above, but enables you to specify a custom function
// used to wrap the main loop of all worker threads
- ThreadStackExecutor(uint32_t threads, uint32_t stackSize,
- init_fun_t init_function,
- uint32_t taskLimit = 0xffffffff);
+ ThreadStackExecutor(uint32_t threads, init_fun_t init_function, uint32_t taskLimit);
+ ThreadStackExecutor(uint32_t threads, init_fun_t init_function);
- /**
- * Will invoke cleanup.
- **/
~ThreadStackExecutor() override;
};
diff --git a/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.cpp b/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.cpp
index 133350f3d56..8b6427d9391 100644
--- a/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.cpp
+++ b/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.cpp
@@ -152,12 +152,10 @@ ThreadStackExecutorBase::run()
//-----------------------------------------------------------------------------
-ThreadStackExecutorBase::ThreadStackExecutorBase(uint32_t stackSize,
- uint32_t taskLimit,
- init_fun_t init_fun)
+ThreadStackExecutorBase::ThreadStackExecutorBase(uint32_t taskLimit, init_fun_t init_fun)
: SyncableThreadExecutor(),
Runnable(),
- _pool(std::make_unique<FastOS_ThreadPool>(stackSize)),
+ _pool(std::make_unique<FastOS_ThreadPool>()),
_lock(),
_cond(),
_stats(),
diff --git a/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h b/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h
index c3552cfe579..501fde92f4c 100644
--- a/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h
+++ b/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h
@@ -150,13 +150,11 @@ protected:
* executor. Both the number of threads and the task limit must be
* greater than 0.
*
- * @param stackSize stack size per worker thread
* @param taskLimit upper limit on accepted tasks
* @param init_fun custom function used to wrap the main loop of
* each worker thread.
**/
- ThreadStackExecutorBase(uint32_t stackSize, uint32_t taskLimit,
- init_fun_t init_fun);
+ ThreadStackExecutorBase(uint32_t taskLimit, init_fun_t init_fun);
/**
* This will start the theads. This is to avoid starting tasks in