From 85115fc4804effd03d89c229be30d13a9d6471c5 Mon Sep 17 00:00:00 2001 From: Tor Egge Date: Thu, 28 Oct 2021 21:03:14 +0200 Subject: Rename ISequencedTaskExecutor::sync() to sync_all(). --- .../adaptive_sequenced_executor_test.cpp | 16 ++++++++-------- .../foregroundtaskexecutor_test.cpp | 6 +++--- .../sequencedtaskexecutor/sequencedtaskexecutor_test.cpp | 16 ++++++++-------- .../vespa/vespalib/util/adaptive_sequenced_executor.cpp | 4 ++-- .../vespa/vespalib/util/adaptive_sequenced_executor.h | 2 +- .../src/vespa/vespalib/util/foregroundtaskexecutor.cpp | 2 +- .../src/vespa/vespalib/util/foregroundtaskexecutor.h | 2 +- .../src/vespa/vespalib/util/isequencedtaskexecutor.h | 8 ++++---- .../src/vespa/vespalib/util/sequencedtaskexecutor.cpp | 4 ++-- .../src/vespa/vespalib/util/sequencedtaskexecutor.h | 2 +- .../vespalib/util/sequencedtaskexecutorobserver.cpp | 4 ++-- .../vespa/vespalib/util/sequencedtaskexecutorobserver.h | 2 +- 12 files changed, 34 insertions(+), 34 deletions(-) (limited to 'staging_vespalib') diff --git a/staging_vespalib/src/tests/sequencedtaskexecutor/adaptive_sequenced_executor_test.cpp b/staging_vespalib/src/tests/sequencedtaskexecutor/adaptive_sequenced_executor_test.cpp index 5c188c3204c..5fc6d2a69ae 100644 --- a/staging_vespalib/src/tests/sequencedtaskexecutor/adaptive_sequenced_executor_test.cpp +++ b/staging_vespalib/src/tests/sequencedtaskexecutor/adaptive_sequenced_executor_test.cpp @@ -72,7 +72,7 @@ TEST_F("testExecute", Fixture) { tv->wait(1); EXPECT_EQUAL(0, tv->_fail); EXPECT_EQUAL(42, tv->_val); - f._threads.sync(); + f._threads.sync_all(); EXPECT_EQUAL(0, tv->_fail); EXPECT_EQUAL(42, tv->_val); } @@ -87,7 +87,7 @@ TEST_F("require that task with same component id are serialized", Fixture) tv->wait(2); EXPECT_EQUAL(0, tv->_fail); EXPECT_EQUAL(42, tv->_val); - f._threads.sync(); + f._threads.sync_all(); EXPECT_EQUAL(0, tv->_fail); EXPECT_EQUAL(42, tv->_val); } @@ -106,7 +106,7 @@ TEST_F("require that task with different component ids are not serialized", Fixt } EXPECT_EQUAL(1, tv->_fail); EXPECT_EQUAL(14, tv->_val); - f._threads.sync(); + f._threads.sync_all(); EXPECT_EQUAL(1, tv->_fail); EXPECT_EQUAL(14, tv->_val); break; @@ -125,7 +125,7 @@ TEST_F("require that task with same string component id are serialized", Fixture tv->wait(2); EXPECT_EQUAL(0, tv->_fail); EXPECT_EQUAL(42, tv->_val); - f._threads.sync(); + f._threads.sync_all(); EXPECT_EQUAL(0, tv->_fail); EXPECT_EQUAL(42, tv->_val); } @@ -146,7 +146,7 @@ int detectSerializeFailure(Fixture &f, vespalib::stringref altComponentId, int t } EXPECT_EQUAL(1, tv->_fail); EXPECT_EQUAL(14, tv->_val); - f._threads.sync(); + f._threads.sync_all(); EXPECT_EQUAL(1, tv->_fail); EXPECT_EQUAL(14, tv->_val); break; @@ -196,7 +196,7 @@ TEST_F("require that execute works with const lambda", Fixture) { res.push_back(i--); res.push_back(i--); }; f._threads.execute(0, lambda); f._threads.execute(0, lambda); - f._threads.sync(); + f._threads.sync_all(); std::vector exp({5, 4, 5, 4}); EXPECT_EQUAL(exp, res); EXPECT_EQUAL(5, i); @@ -211,7 +211,7 @@ TEST_F("require that execute works with reference to lambda", Fixture) auto &lambdaref = lambda; f._threads.execute(0, lambdaref); f._threads.execute(0, lambdaref); - f._threads.sync(); + f._threads.sync_all(); std::vector exp({5, 4, 5, 4}); EXPECT_EQUAL(exp, res); EXPECT_EQUAL(5, i); @@ -224,7 +224,7 @@ TEST_F("require that executeLambda works", Fixture) const auto lambda = [i, &res]() mutable { res.push_back(i--); res.push_back(i--); }; f._threads.executeLambda(ISequencedTaskExecutor::ExecutorId(0), lambda); - f._threads.sync(); + f._threads.sync_all(); std::vector exp({5, 4}); EXPECT_EQUAL(exp, res); EXPECT_EQUAL(5, i); diff --git a/staging_vespalib/src/tests/sequencedtaskexecutor/foregroundtaskexecutor_test.cpp b/staging_vespalib/src/tests/sequencedtaskexecutor/foregroundtaskexecutor_test.cpp index ae01452c46b..56fb570209c 100644 --- a/staging_vespalib/src/tests/sequencedtaskexecutor/foregroundtaskexecutor_test.cpp +++ b/staging_vespalib/src/tests/sequencedtaskexecutor/foregroundtaskexecutor_test.cpp @@ -72,7 +72,7 @@ TEST_F("testExecute", Fixture) { tv->wait(1); EXPECT_EQUAL(0, tv->_fail); EXPECT_EQUAL(42, tv->_val); - f._threads.sync(); + f._threads.sync_all(); EXPECT_EQUAL(0, tv->_fail); EXPECT_EQUAL(42, tv->_val); } @@ -87,7 +87,7 @@ TEST_F("require that task with same id are serialized", Fixture) tv->wait(2); EXPECT_EQUAL(0, tv->_fail); EXPECT_EQUAL(42, tv->_val); - f._threads.sync(); + f._threads.sync_all(); EXPECT_EQUAL(0, tv->_fail); EXPECT_EQUAL(42, tv->_val); } @@ -106,7 +106,7 @@ TEST_F("require that task with different ids are serialized", Fixture) } EXPECT_EQUAL(1, tv->_fail); EXPECT_EQUAL(14, tv->_val); - f._threads.sync(); + f._threads.sync_all(); EXPECT_EQUAL(1, tv->_fail); EXPECT_EQUAL(14, tv->_val); break; diff --git a/staging_vespalib/src/tests/sequencedtaskexecutor/sequencedtaskexecutor_test.cpp b/staging_vespalib/src/tests/sequencedtaskexecutor/sequencedtaskexecutor_test.cpp index 705c7174c4a..7c90f96afdd 100644 --- a/staging_vespalib/src/tests/sequencedtaskexecutor/sequencedtaskexecutor_test.cpp +++ b/staging_vespalib/src/tests/sequencedtaskexecutor/sequencedtaskexecutor_test.cpp @@ -76,7 +76,7 @@ TEST_F("testExecute", Fixture) { tv->wait(1); EXPECT_EQUAL(0, tv->_fail); EXPECT_EQUAL(42, tv->_val); - f._threads->sync(); + f._threads->sync_all(); EXPECT_EQUAL(0, tv->_fail); EXPECT_EQUAL(42, tv->_val); } @@ -91,7 +91,7 @@ TEST_F("require that task with same component id are serialized", Fixture) tv->wait(2); EXPECT_EQUAL(0, tv->_fail); EXPECT_EQUAL(42, tv->_val); - f._threads->sync(); + f._threads->sync_all(); EXPECT_EQUAL(0, tv->_fail); EXPECT_EQUAL(42, tv->_val); } @@ -110,7 +110,7 @@ TEST_F("require that task with different component ids are not serialized", Fixt } EXPECT_EQUAL(1, tv->_fail); EXPECT_EQUAL(14, tv->_val); - f._threads->sync(); + f._threads->sync_all(); EXPECT_EQUAL(1, tv->_fail); EXPECT_EQUAL(14, tv->_val); break; @@ -129,7 +129,7 @@ TEST_F("require that task with same string component id are serialized", Fixture tv->wait(2); EXPECT_EQUAL(0, tv->_fail); EXPECT_EQUAL(42, tv->_val); - f._threads->sync(); + f._threads->sync_all(); EXPECT_EQUAL(0, tv->_fail); EXPECT_EQUAL(42, tv->_val); } @@ -150,7 +150,7 @@ int detectSerializeFailure(Fixture &f, vespalib::stringref altComponentId, int t } EXPECT_EQUAL(1, tv->_fail); EXPECT_EQUAL(14, tv->_val); - f._threads->sync(); + f._threads->sync_all(); EXPECT_EQUAL(1, tv->_fail); EXPECT_EQUAL(14, tv->_val); break; @@ -200,7 +200,7 @@ TEST_F("require that execute works with const lambda", Fixture) { res.push_back(i--); res.push_back(i--); }; f._threads->execute(0, lambda); f._threads->execute(0, lambda); - f._threads->sync(); + f._threads->sync_all(); std::vector exp({5, 4, 5, 4}); EXPECT_EQUAL(exp, res); EXPECT_EQUAL(5, i); @@ -215,7 +215,7 @@ TEST_F("require that execute works with reference to lambda", Fixture) auto &lambdaref = lambda; f._threads->execute(0, lambdaref); f._threads->execute(0, lambdaref); - f._threads->sync(); + f._threads->sync_all(); std::vector exp({5, 4, 5, 4}); EXPECT_EQUAL(exp, res); EXPECT_EQUAL(5, i); @@ -228,7 +228,7 @@ TEST_F("require that executeLambda works", Fixture) const auto lambda = [i, &res]() mutable { res.push_back(i--); res.push_back(i--); }; f._threads->executeLambda(ISequencedTaskExecutor::ExecutorId(0), lambda); - f._threads->sync(); + f._threads->sync_all(); std::vector exp({5, 4}); EXPECT_EQUAL(exp, res); EXPECT_EQUAL(5, i); diff --git a/staging_vespalib/src/vespa/vespalib/util/adaptive_sequenced_executor.cpp b/staging_vespalib/src/vespa/vespalib/util/adaptive_sequenced_executor.cpp index 7ffa396304c..4d08e14375c 100644 --- a/staging_vespalib/src/vespa/vespalib/util/adaptive_sequenced_executor.cpp +++ b/staging_vespalib/src/vespa/vespalib/util/adaptive_sequenced_executor.cpp @@ -246,7 +246,7 @@ AdaptiveSequencedExecutor::AdaptiveSequencedExecutor(size_t num_strands, size_t AdaptiveSequencedExecutor::~AdaptiveSequencedExecutor() { - sync(); + sync_all(); { auto guard = std::unique_lock(_mutex); assert(_self.state == Self::State::OPEN); @@ -305,7 +305,7 @@ AdaptiveSequencedExecutor::executeTask(ExecutorId id, Task::UP task) } void -AdaptiveSequencedExecutor::sync() +AdaptiveSequencedExecutor::sync_all() { BarrierCompletion barrierCompletion; { diff --git a/staging_vespalib/src/vespa/vespalib/util/adaptive_sequenced_executor.h b/staging_vespalib/src/vespa/vespalib/util/adaptive_sequenced_executor.h index 185345ebc9c..ccf6ab977f3 100644 --- a/staging_vespalib/src/vespa/vespalib/util/adaptive_sequenced_executor.h +++ b/staging_vespalib/src/vespa/vespalib/util/adaptive_sequenced_executor.h @@ -147,7 +147,7 @@ public: ~AdaptiveSequencedExecutor() override; ExecutorId getExecutorId(uint64_t component) const override; void executeTask(ExecutorId id, Task::UP task) override; - void sync() override; + void sync_all() override; void setTaskLimit(uint32_t task_limit) override; ExecutorStats getStats() override; Config get_config() const; diff --git a/staging_vespalib/src/vespa/vespalib/util/foregroundtaskexecutor.cpp b/staging_vespalib/src/vespa/vespalib/util/foregroundtaskexecutor.cpp index 703256c5521..ce5237f41c9 100644 --- a/staging_vespalib/src/vespa/vespalib/util/foregroundtaskexecutor.cpp +++ b/staging_vespalib/src/vespa/vespalib/util/foregroundtaskexecutor.cpp @@ -27,7 +27,7 @@ ForegroundTaskExecutor::executeTask(ExecutorId id, Executor::Task::UP task) } void -ForegroundTaskExecutor::sync() +ForegroundTaskExecutor::sync_all() { } diff --git a/staging_vespalib/src/vespa/vespalib/util/foregroundtaskexecutor.h b/staging_vespalib/src/vespa/vespalib/util/foregroundtaskexecutor.h index 9d351aca653..615bf62afe5 100644 --- a/staging_vespalib/src/vespa/vespalib/util/foregroundtaskexecutor.h +++ b/staging_vespalib/src/vespa/vespalib/util/foregroundtaskexecutor.h @@ -23,7 +23,7 @@ public: ExecutorId getExecutorId(uint64_t componentId) const override; void executeTask(ExecutorId id, Executor::Task::UP task) override; - void sync() override; + void sync_all() override; void setTaskLimit(uint32_t taskLimit) override; ExecutorStats getStats() override; private: diff --git a/staging_vespalib/src/vespa/vespalib/util/isequencedtaskexecutor.h b/staging_vespalib/src/vespa/vespalib/util/isequencedtaskexecutor.h index a6aca98a65d..8268363d335 100644 --- a/staging_vespalib/src/vespa/vespalib/util/isequencedtaskexecutor.h +++ b/staging_vespalib/src/vespa/vespalib/util/isequencedtaskexecutor.h @@ -58,7 +58,7 @@ public: /** * Wrap lambda function into a task and schedule it to be run. * Caller must ensure that pointers and references are valid and - * call sync before tearing down pointed to/referenced data. + * call sync_all before tearing down pointed to/referenced data. * * @param id which internal executor to use * @param function function to be wrapped in a task and later executed @@ -70,7 +70,7 @@ public: /** * Wait for all scheduled tasks to complete. */ - virtual void sync() = 0; + virtual void sync_all() = 0; virtual void setTaskLimit(uint32_t taskLimit) = 0; @@ -79,7 +79,7 @@ public: /** * Wrap lambda function into a task and schedule it to be run. * Caller must ensure that pointers and references are valid and - * call sync before tearing down pointed to/referenced data. + * call sync_all before tearing down pointed to/referenced data. * * @param componentId component id * @param function function to be wrapped in a task and later executed @@ -93,7 +93,7 @@ public: /** * Wrap lambda function into a task and schedule it to be run. * Caller must ensure that pointers and references are valid and - * call sync before tearing down pointed to/referenced data. + * call sync_all before tearing down pointed to/referenced data. * * @param id executor id * @param function function to be wrapped in a task and later executed diff --git a/staging_vespalib/src/vespa/vespalib/util/sequencedtaskexecutor.cpp b/staging_vespalib/src/vespa/vespalib/util/sequencedtaskexecutor.cpp index 9e95bdaa3ab..038b9201724 100644 --- a/staging_vespalib/src/vespa/vespalib/util/sequencedtaskexecutor.cpp +++ b/staging_vespalib/src/vespa/vespalib/util/sequencedtaskexecutor.cpp @@ -51,7 +51,7 @@ SequencedTaskExecutor::create(vespalib::Runnable::init_fun_t func, uint32_t thre SequencedTaskExecutor::~SequencedTaskExecutor() { - sync(); + sync_all(); } SequencedTaskExecutor::SequencedTaskExecutor(std::unique_ptr>> executors) @@ -82,7 +82,7 @@ SequencedTaskExecutor::executeTask(ExecutorId id, vespalib::Executor::Task::UP t } void -SequencedTaskExecutor::sync() { +SequencedTaskExecutor::sync_all() { wakeup(); for (auto &executor : *_executors) { executor->sync(); diff --git a/staging_vespalib/src/vespa/vespalib/util/sequencedtaskexecutor.h b/staging_vespalib/src/vespa/vespalib/util/sequencedtaskexecutor.h index 7b49f7aac75..245d6d29780 100644 --- a/staging_vespalib/src/vespa/vespalib/util/sequencedtaskexecutor.h +++ b/staging_vespalib/src/vespa/vespalib/util/sequencedtaskexecutor.h @@ -24,7 +24,7 @@ public: void setTaskLimit(uint32_t taskLimit) override; void executeTask(ExecutorId id, vespalib::Executor::Task::UP task) override; ExecutorId getExecutorId(uint64_t componentId) const override; - void sync() override; + void sync_all() override; ExecutorStats getStats() override; void wakeup() override; diff --git a/staging_vespalib/src/vespa/vespalib/util/sequencedtaskexecutorobserver.cpp b/staging_vespalib/src/vespa/vespalib/util/sequencedtaskexecutorobserver.cpp index 4f4a2e6ab6d..5ae8e96b606 100644 --- a/staging_vespalib/src/vespa/vespalib/util/sequencedtaskexecutorobserver.cpp +++ b/staging_vespalib/src/vespa/vespalib/util/sequencedtaskexecutorobserver.cpp @@ -28,10 +28,10 @@ SequencedTaskExecutorObserver::executeTask(ExecutorId id, vespalib::Executor::Ta } void -SequencedTaskExecutorObserver::sync() +SequencedTaskExecutorObserver::sync_all() { ++_syncCnt; - _executor.sync(); + _executor.sync_all(); } std::vector diff --git a/staging_vespalib/src/vespa/vespalib/util/sequencedtaskexecutorobserver.h b/staging_vespalib/src/vespa/vespalib/util/sequencedtaskexecutorobserver.h index 71717c051e7..7e2bf968952 100644 --- a/staging_vespalib/src/vespa/vespalib/util/sequencedtaskexecutorobserver.h +++ b/staging_vespalib/src/vespa/vespalib/util/sequencedtaskexecutorobserver.h @@ -25,7 +25,7 @@ public: ExecutorId getExecutorId(uint64_t componentId) const override; void executeTask(ExecutorId id, vespalib::Executor::Task::UP task) override; - void sync() override; + void sync_all() override; void setTaskLimit(uint32_t taskLimit) override; vespalib::ExecutorStats getStats() override; -- cgit v1.2.3