From 8946dbea418f760e4f0a5cbe2eb2bcbcddd25032 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Tue, 3 Dec 2019 14:24:41 +0000 Subject: FastOS_THread::Sleep -> std::chrono::sleep_for Renamed Timer -> ScheduledExecutor. Do not include thread.h when not needed in header files. --- slobrok/src/tests/configure/configure.cpp | 4 ++-- slobrok/src/tests/mirrorapi/mirrorapi.cpp | 6 +++--- slobrok/src/tests/registerapi/registerapi.cpp | 6 +++--- slobrok/src/tests/standalone/standalone.cpp | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) (limited to 'slobrok/src') diff --git a/slobrok/src/tests/configure/configure.cpp b/slobrok/src/tests/configure/configure.cpp index bf41b77ab05..fa509c17d0c 100644 --- a/slobrok/src/tests/configure/configure.cpp +++ b/slobrok/src/tests/configure/configure.cpp @@ -85,7 +85,7 @@ compare(MirrorAPI &api, const char *pattern, SpecList expect) if (actual == expect) { return true; } - FastOS_Thread::Sleep(100); + std::this_thread::sleep_for(100ms); } SpecList actual(api.lookup(pattern)); std::cerr << "Actual: " << actual.strVal() << std::endl; @@ -176,7 +176,7 @@ Test::Main() srv2Builder.slobrok[0].connectionspec = createSpec(18525); cfgCtx->reload(); - FastOS_Thread::Sleep(6000); // reconfiguration time + std::this_thread::sleep_for(6s); // reconfiguration time reg1.registerName("A"); reg2.registerName("B"); diff --git a/slobrok/src/tests/mirrorapi/mirrorapi.cpp b/slobrok/src/tests/mirrorapi/mirrorapi.cpp index b25e338533c..53e194fad2d 100644 --- a/slobrok/src/tests/mirrorapi/mirrorapi.cpp +++ b/slobrok/src/tests/mirrorapi/mirrorapi.cpp @@ -112,7 +112,7 @@ compare(MirrorAPI &api, const char *pattern, SpecList expect) if (actual == expect) { return true; } - FastOS_Thread::Sleep(100); + std::this_thread::sleep_for(100ms); } return false; } @@ -124,7 +124,7 @@ Test::Main() TEST_INIT("mirrorapi_test"); SlobrokServer mock(18501); - FastOS_Thread::Sleep(300); + std::this_thread::sleep_for(300ms); Server a("A/x/w", 18502, "tcp/localhost:18501"); Server b("B/x", 18503, "tcp/localhost:18501"); @@ -143,7 +143,7 @@ Test::Main() MirrorAPI mirror(supervisor, config::ConfigUri::createFromInstance(specBuilder)); EXPECT_TRUE(!mirror.ready()); transport.Start(&threadPool); - FastOS_Thread::Sleep(1000); + std::this_thread::sleep_for(1s); a.reg(); EXPECT_TRUE(compare(mirror, "A/x/w", SpecList().add("A/x/w", "tcp/localhost:18502"))); diff --git a/slobrok/src/tests/registerapi/registerapi.cpp b/slobrok/src/tests/registerapi/registerapi.cpp index ac7e662c6f2..92f08ee41cb 100644 --- a/slobrok/src/tests/registerapi/registerapi.cpp +++ b/slobrok/src/tests/registerapi/registerapi.cpp @@ -64,7 +64,7 @@ compare(MirrorAPI &api, const char *pattern, SpecList expect) if (actual == expect) { return true; } - FastOS_Thread::Sleep(100); + std::this_thread::sleep_for(100ms); } return false; } @@ -75,7 +75,7 @@ Test::Main() TEST_INIT("registerapi_test"); SlobrokServer mock(18548); - FastOS_Thread::Sleep(300); + std::this_thread::sleep_for(300ms); cloud::config::SlobroksConfigBuilder slobrokSpecs; cloud::config::SlobroksConfig::Slobrok sb; @@ -97,7 +97,7 @@ Test::Main() EXPECT_TRUE(compare(mirror, "*/*/*", SpecList().add("A/x/w", myspec.c_str()))); for (int i = 0; i < 30; i++) { - if (reg.busy()) FastOS_Thread::Sleep(100); + if (reg.busy()) std::this_thread::sleep_for(100ms); } EXPECT_TRUE(!reg.busy()); diff --git a/slobrok/src/tests/standalone/standalone.cpp b/slobrok/src/tests/standalone/standalone.cpp index 9d3fd694ee1..65553c57530 100644 --- a/slobrok/src/tests/standalone/standalone.cpp +++ b/slobrok/src/tests/standalone/standalone.cpp @@ -132,7 +132,7 @@ TEST("standalone") { break; } fprintf(stderr, "ping failed [retry %d]\n", retry); - FastOS_Thread::Sleep(200); + std::this_thread::sleep_for(200ms); sb->SubRef(); sb = orb.GetTarget(18541); } @@ -268,7 +268,7 @@ TEST("standalone") { } } - FastOS_Thread::Sleep(2000); + std::this_thread::sleep_for(2s); // lookup 'B' should give '' req = orb.AllocRPCRequest(req); -- cgit v1.2.3