aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/end2end/thread_stress_test.cc
diff options
context:
space:
mode:
authorGravatar Vijay Pai <vpai@google.com>2015-05-21 23:10:29 -0700
committerGravatar Vijay Pai <vpai@google.com>2015-05-21 23:10:29 -0700
commitbfc01822b11fe5c10c68701b7e92c6760045b95b (patch)
tree2c1fa1d61e6a8ca2e3fff61b07665f059f4f5fdf /test/cpp/end2end/thread_stress_test.cc
parent2178c134de298e5d5a5868a83f33ccdf06136c0d (diff)
parentfeb67f67dc3d8d5329e5dda9cac0c96c1b9f03e8 (diff)
Merge pull request #1693 from dgquintas/fix_sleep_for
Replaced std::this_thread::sleep_for for gpr_sleep_until.
Diffstat (limited to 'test/cpp/end2end/thread_stress_test.cc')
-rw-r--r--test/cpp/end2end/thread_stress_test.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/test/cpp/end2end/thread_stress_test.cc b/test/cpp/end2end/thread_stress_test.cc
index 12656128c0..310227a29c 100644
--- a/test/cpp/end2end/thread_stress_test.cc
+++ b/test/cpp/end2end/thread_stress_test.cc
@@ -94,14 +94,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());