diff --git a/include/grpc++/impl/codegen/status.h b/include/grpc++/impl/codegen/status.h index 31fd6cdbe78f68a1ad4f3854770231dc9920b5e5..e89103f85b9242d05b7d97d83ecc2c13750bb9d1 100644 --- a/include/grpc++/impl/codegen/status.h +++ b/include/grpc++/impl/codegen/status.h @@ -75,6 +75,11 @@ class Status { /// Is the status OK? bool ok() const { return code_ == StatusCode::OK; } + // Ignores any errors. This method does nothing except potentially suppress + // complaints from any tools that are checking that errors are not dropped on + // the floor. + void IgnoreError() const {} + private: StatusCode code_; grpc::string error_message_; diff --git a/src/core/lib/iomgr/timer_manager.c b/src/core/lib/iomgr/timer_manager.c index 24085093e70ddfe59753fe07e79244a53f5c9789..fd9a7a2f041ac8e59d6278ff672b014146a59043 100644 --- a/src/core/lib/iomgr/timer_manager.c +++ b/src/core/lib/iomgr/timer_manager.c @@ -93,10 +93,10 @@ static void start_timer_thread_and_unlock(void) { if (GRPC_TRACER_ON(grpc_timer_check_trace)) { gpr_log(GPR_DEBUG, "Spawn timer thread"); } - gpr_thd_id thd; gpr_thd_options opt = gpr_thd_options_default(); gpr_thd_options_set_joinable(&opt); - gpr_thd_new(&thd, timer_thread, NULL, &opt); + completed_thread *ct = gpr_malloc(sizeof(*ct)); + gpr_thd_new(&ct->t, timer_thread, ct, &opt); } void grpc_timer_manager_tick() { @@ -107,7 +107,7 @@ void grpc_timer_manager_tick() { grpc_exec_ctx_finish(&exec_ctx); } -static void timer_thread(void *unused) { +static void timer_thread(void *completed_thread_ptr) { // this threads exec_ctx: we try to run things through to completion here // since it's easy to spin up new threads grpc_exec_ctx exec_ctx = @@ -194,8 +194,7 @@ static void timer_thread(void *unused) { if (0 == g_thread_count) { gpr_cv_signal(&g_cv_shutdown); } - completed_thread *ct = gpr_malloc(sizeof(*ct)); - ct->t = gpr_thd_currentid(); + completed_thread *ct = completed_thread_ptr; ct->next = g_completed_threads; g_completed_threads = ct; gpr_mu_unlock(&g_mu); diff --git a/test/cpp/end2end/BUILD b/test/cpp/end2end/BUILD index 9b691a83e0986f44b16ce7dce5c5ac73c33c7096..1f7a4870d4459cd781c4c4fb700abb849bd07de8 100644 --- a/test/cpp/end2end/BUILD +++ b/test/cpp/end2end/BUILD @@ -35,6 +35,7 @@ package(default_visibility=["//visibility:public"]) # Allows external users to i grpc_cc_library( name = "test_service_impl", + testonly = True, srcs = ["test_service_impl.cc"], hdrs = ["test_service_impl.h"], deps = [ diff --git a/test/cpp/interop/BUILD b/test/cpp/interop/BUILD index 04c3489adc4ec5c67fe09de70b26f74d9ce771c6..8892da32beef0a0eb4d0a9caee80d6381e449a7d 100644 --- a/test/cpp/interop/BUILD +++ b/test/cpp/interop/BUILD @@ -86,13 +86,21 @@ grpc_cc_library( ], ) -grpc_cc_binary( - name = "interop_client", +grpc_cc_library( + name = "interop_client_main", language = "c++", srcs = [ "client.cc", ], deps = [ - ":client_helper_lib", + ":client_helper_lib" + ], +) + +grpc_cc_binary( + name = "interop_client", + language = "c++", + deps = [ + ":interop_client_main", ], ) diff --git a/test/cpp/qps/BUILD b/test/cpp/qps/BUILD index c6a1fd2fcee56d33ccbe2a7411f2a1577e347e44..1f33dc55ff578367de783146d6f5d78c9be935d4 100644 --- a/test/cpp/qps/BUILD +++ b/test/cpp/qps/BUILD @@ -67,9 +67,6 @@ grpc_cc_library( "//test/core/util:grpc_test_util", "//test/cpp/util:test_util", ], - external_deps = [ - "gtest", - ], ) grpc_cc_library( diff --git a/test/cpp/qps/client_sync.cc b/test/cpp/qps/client_sync.cc index f35713280a1af282b62c542650104f33bcd5e84b..0aae82604dc1f63cde25de2c6fbf5b0b58c2fca4 100644 --- a/test/cpp/qps/client_sync.cc +++ b/test/cpp/qps/client_sync.cc @@ -155,7 +155,7 @@ class SynchronousStreamingClient : public SynchronousClient { if (*stream) { // forcibly cancel the streams, then finish context_[i].TryCancel(); - (*stream)->Finish(); + (*stream)->Finish().IgnoreError(); // don't log any error message on !ok since this was canceled } });