diff options
Diffstat (limited to 'test/cpp/end2end/end2end_test.cc')
-rw-r--r-- | test/cpp/end2end/end2end_test.cc | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index 76271c3e1d..7a15591b44 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -96,14 +96,16 @@ class TestServiceImpl : public ::grpc::cpp::test::util::TestService::Service { signal_client_ = true; } while (!context->IsCancelled()) { - std::this_thread::sleep_for(std::chrono::microseconds( - request->param().client_cancel_after_us())); + gpr_sleep_until(gpr_time_add( + gpr_now(), + gpr_time_from_micros(request->param().client_cancel_after_us()))); } return Status::Cancelled; } else if (request->has_param() && request->param().server_cancel_after_us()) { - std::this_thread::sleep_for( - std::chrono::microseconds(request->param().server_cancel_after_us())); + gpr_sleep_until(gpr_time_add( + gpr_now(), + gpr_time_from_micros(request->param().server_cancel_after_us()))); return Status::Cancelled; } else { EXPECT_FALSE(context->IsCancelled()); @@ -469,7 +471,7 @@ TEST_F(End2endTest, BadCredentials) { } void CancelRpc(ClientContext* context, int delay_us, TestServiceImpl* service) { - std::this_thread::sleep_for(std::chrono::microseconds(delay_us)); + gpr_sleep_until(gpr_time_add(gpr_now(), gpr_time_from_micros(delay_us))); while (!service->signal_client()) { } context->TryCancel(); |