diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2021-01-31 15:14:57 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2021-01-31 17:36:43 +0000 |
commit | 2503a877f21838e66e873f839a5b6fd0c38abfab (patch) | |
tree | 966ae9d7757aa58e7bff4aaa4b9b45b5f6668329 /staging_vespalib | |
parent | 5ac0d0b71749c7555167c3c3906ff6843bf178f0 (diff) |
Use vespalib::duration for timeouts
Diffstat (limited to 'staging_vespalib')
4 files changed, 8 insertions, 7 deletions
diff --git a/staging_vespalib/src/tests/clock/clock_test.cpp b/staging_vespalib/src/tests/clock/clock_test.cpp index 06eee21d2b9..b1572d11dd7 100644 --- a/staging_vespalib/src/tests/clock/clock_test.cpp +++ b/staging_vespalib/src/tests/clock/clock_test.cpp @@ -3,6 +3,7 @@ #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/util/clock.h> #include <vespa/fastos/thread.h> +#include <thread> using vespalib::Clock; using vespalib::duration; diff --git a/staging_vespalib/src/tests/shutdownguard/shutdownguard_test.cpp b/staging_vespalib/src/tests/shutdownguard/shutdownguard_test.cpp index 04a811494c9..24607add153 100644 --- a/staging_vespalib/src/tests/shutdownguard/shutdownguard_test.cpp +++ b/staging_vespalib/src/tests/shutdownguard/shutdownguard_test.cpp @@ -1,6 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/util/shutdownguard.h> +#include <thread> #include <unistd.h> #include <sys/wait.h> #include <cstdlib> diff --git a/staging_vespalib/src/tests/timer/timer_test.cpp b/staging_vespalib/src/tests/timer/timer_test.cpp index 04b541e75e9..2031e3cdcbe 100644 --- a/staging_vespalib/src/tests/timer/timer_test.cpp +++ b/staging_vespalib/src/tests/timer/timer_test.cpp @@ -37,10 +37,10 @@ void Test::testScheduling() vespalib::CountDownLatch latch1(3); vespalib::CountDownLatch latch2(2); ScheduledExecutor timer; - timer.scheduleAtFixedRate(Task::UP(new TestTask(latch1)), 100ms, 200ms); - timer.scheduleAtFixedRate(Task::UP(new TestTask(latch2)), 500ms, 500ms); - EXPECT_TRUE(latch1.await(60000)); - EXPECT_TRUE(latch2.await(60000)); + timer.scheduleAtFixedRate(std::make_unique<TestTask>(latch1), 100ms, 200ms); + timer.scheduleAtFixedRate(std::make_unique<TestTask>(latch2), 500ms, 500ms); + EXPECT_TRUE(latch1.await(60s)); + EXPECT_TRUE(latch2.await(60s)); } void Test::testReset() @@ -49,9 +49,9 @@ void Test::testReset() ScheduledExecutor timer; timer.scheduleAtFixedRate(std::make_unique<TestTask>(latch1), 2s, 3s); timer.reset(); - EXPECT_TRUE(!latch1.await(3000)); + EXPECT_TRUE(!latch1.await(3s)); timer.scheduleAtFixedRate(std::make_unique<TestTask>(latch1), 200ms, 300ms); - EXPECT_TRUE(latch1.await(60000)); + EXPECT_TRUE(latch1.await(60s)); } TEST_APPHOOK(Test) 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 ed2209d130a..4e0388caf8a 100644 --- a/staging_vespalib/src/vespa/vespalib/util/adaptive_sequenced_executor.h +++ b/staging_vespalib/src/vespa/vespalib/util/adaptive_sequenced_executor.h @@ -6,7 +6,6 @@ #include <vespa/vespalib/util/arrayqueue.hpp> #include <vespa/vespalib/util/gate.h> #include <vespa/vespalib/util/eventbarrier.hpp> -#include <vespa/vespalib/util/gate.h> #include <vespa/fastos/thread.h> #include <mutex> #include <condition_variable> |