diff options
Diffstat (limited to 'vespalib')
7 files changed, 14 insertions, 7 deletions
diff --git a/vespalib/src/tests/delegatelist/delegatelist.cpp b/vespalib/src/tests/delegatelist/delegatelist.cpp index ba1a2049794..070864dd85a 100644 --- a/vespalib/src/tests/delegatelist/delegatelist.cpp +++ b/vespalib/src/tests/delegatelist/delegatelist.cpp @@ -780,11 +780,11 @@ Test::testWaitSnapshots() ASSERT_TRUE(pool.NewThread(&a1, 0) != 0); s1.reset(new DL::Snapshot(dl)); // create snap 1 a1.doIt(cmd_wait_snap(&dl)); // wait for snaps - FastOS_Thread::Sleep(1000); + std::this_thread::sleep_for(1s); EXPECT_TRUE(a1.getState() == Actor::STATE_BUSY); // still waiting... s2.reset(new DL::Snapshot(dl)); // create snap 2 s1.reset(); // destroy snap 1 - FastOS_Thread::Sleep(1000); + std::this_thread::sleep_for(1s); EXPECT_TRUE(a1.getState() == Actor::STATE_IDLE); // wait done! a1.doIt(cmd_exit()); a1.waitState(Actor::STATE_DONE); diff --git a/vespalib/src/tests/left_right_heap/left_right_heap_bench.cpp b/vespalib/src/tests/left_right_heap/left_right_heap_bench.cpp index c43d0ec1c29..7567e8426ae 100644 --- a/vespalib/src/tests/left_right_heap/left_right_heap_bench.cpp +++ b/vespalib/src/tests/left_right_heap/left_right_heap_bench.cpp @@ -5,7 +5,12 @@ #include <vespa/vespalib/util/inline.h> #include <vespa/fastos/timestamp.h> -using namespace vespalib; +using vespalib::RightArrayHeap; +using vespalib::RightHeap; +using vespalib::LeftArrayHeap; +using vespalib::LeftHeap; +using vespalib::LeftStdHeap; +using vespalib::make_string; template <typename H> struct IsRight { enum { VALUE = 0 }; }; template <> struct IsRight<RightHeap> { enum { VALUE = 1 }; }; diff --git a/vespalib/src/tests/simple_thread_bundle/simple_thread_bundle_test.cpp b/vespalib/src/tests/simple_thread_bundle/simple_thread_bundle_test.cpp index 7ca4a2eff39..5641d751f34 100644 --- a/vespalib/src/tests/simple_thread_bundle/simple_thread_bundle_test.cpp +++ b/vespalib/src/tests/simple_thread_bundle/simple_thread_bundle_test.cpp @@ -47,7 +47,7 @@ TEST_MT_FF("require that signals can be counted and cancelled", 2, Signal, size_ if (thread_id == 0) { for (size_t i = 0; i < f2; ++i) { f1.send(); - if (i % 128 == 0) { FastOS_Thread::Sleep(1); } + if (i % 128 == 0) { std::this_thread::sleep_for(1ms); } } TEST_BARRIER(); f1.cancel(); diff --git a/vespalib/src/tests/simple_thread_bundle/threading_speed_test.cpp b/vespalib/src/tests/simple_thread_bundle/threading_speed_test.cpp index 5b6df6eef4e..d67c417b71a 100644 --- a/vespalib/src/tests/simple_thread_bundle/threading_speed_test.cpp +++ b/vespalib/src/tests/simple_thread_bundle/threading_speed_test.cpp @@ -65,7 +65,7 @@ TEST("estimate cost of thread bundle fork/join") { if (time < minTime) { minTime = time; } - FastOS_Thread::Sleep(10); + std::this_thread::sleep_for(10ms); } fprintf(stderr, "strategy: %s, threads: %zu, fork: %zu, iter: %zu, time: %g, unit: %g\n", strategy_name[strategy].c_str(), threads, fork, iter, minTime, diff --git a/vespalib/src/tests/thread/thread_test.cpp b/vespalib/src/tests/thread/thread_test.cpp index 025a33fa221..bcd38190c7e 100644 --- a/vespalib/src/tests/thread/thread_test.cpp +++ b/vespalib/src/tests/thread/thread_test.cpp @@ -32,7 +32,7 @@ TEST("normal operation") { { Thread thread(agent); thread.start(); - FastOS_Thread::Sleep(20); + std::this_thread::sleep_for(20ms); thread.stop().join(); } EXPECT_TRUE(agent.started); diff --git a/vespalib/src/vespa/vespalib/testkit/test_kit.h b/vespalib/src/vespa/vespalib/testkit/test_kit.h index 7e6b07d71df..17746c5b0fc 100644 --- a/vespalib/src/vespa/vespalib/testkit/test_kit.h +++ b/vespalib/src/vespa/vespalib/testkit/test_kit.h @@ -10,3 +10,4 @@ #include "test_hook.h" #include "test_state_guard.h" #include "time_bomb.h" +#include <vespa/vespalib/util/time.h> diff --git a/vespalib/src/vespa/vespalib/util/thread.cpp b/vespalib/src/vespa/vespalib/util/thread.cpp index 2d0118645ab..4eb436458a2 100644 --- a/vespalib/src/vespa/vespalib/util/thread.cpp +++ b/vespalib/src/vespa/vespalib/util/thread.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 "thread.h" +#include <thread> namespace vespalib { @@ -87,7 +88,7 @@ Thread::currentThread() void Thread::sleep(size_t ms) { - FastOS_Thread::Sleep(ms); + std::this_thread::sleep_for(std::chrono::milliseconds(ms)); } } // namespace vespalib |