aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/surface/concurrent_connectivity_test.cc
diff options
context:
space:
mode:
authorGravatar Dave MacLachlan <dmaclach@gmail.com>2017-11-29 16:25:10 -0800
committerGravatar Dave MacLachlan <dmaclach@gmail.com>2017-11-29 16:25:10 -0800
commitaf5c54de9cdf3a8ac27aa428571d98a93f32cc1f (patch)
tree5ba4015c5d815aa9652efe44e95d6afd9b430090 /test/core/surface/concurrent_connectivity_test.cc
parentc99a3ca415fcf5581f9c365e4dc3004e858fc76a (diff)
Add thread naming support on platforms that support it.
As a client of grpc I want to be aware of which threads are being created by grpc, and giving them recognizable names makes it significantly easier to diagnose what is going on in my programs. This provides thread names for macOS and Linux. Adding support for other platforms should be easy for platform specialists.
Diffstat (limited to 'test/core/surface/concurrent_connectivity_test.cc')
-rw-r--r--test/core/surface/concurrent_connectivity_test.cc16
1 files changed, 10 insertions, 6 deletions
diff --git a/test/core/surface/concurrent_connectivity_test.cc b/test/core/surface/concurrent_connectivity_test.cc
index 8fa15ab331..50bea0aee1 100644
--- a/test/core/surface/concurrent_connectivity_test.cc
+++ b/test/core/surface/concurrent_connectivity_test.cc
@@ -180,7 +180,8 @@ int run_concurrent_connectivity_test() {
/* First round, no server */
gpr_log(GPR_DEBUG, "Wave 1");
for (size_t i = 0; i < NUM_THREADS; ++i) {
- gpr_thd_new(&threads[i], create_loop_destroy, localhost, &options);
+ gpr_thd_new(&threads[i], "gpr_wave_1", create_loop_destroy, localhost,
+ &options);
}
for (size_t i = 0; i < NUM_THREADS; ++i) {
gpr_thd_join(threads[i]);
@@ -196,10 +197,11 @@ int run_concurrent_connectivity_test() {
args.cq = grpc_completion_queue_create_for_next(nullptr);
grpc_server_register_completion_queue(args.server, args.cq, nullptr);
grpc_server_start(args.server);
- gpr_thd_new(&server, server_thread, &args, &options);
+ gpr_thd_new(&server, "gpr_wave_2_server", server_thread, &args, &options);
for (size_t i = 0; i < NUM_THREADS; ++i) {
- gpr_thd_new(&threads[i], create_loop_destroy, args.addr, &options);
+ gpr_thd_new(&threads[i], "gpr_wave_2", create_loop_destroy, args.addr,
+ &options);
}
for (size_t i = 0; i < NUM_THREADS; ++i) {
gpr_thd_join(threads[i]);
@@ -216,11 +218,12 @@ int run_concurrent_connectivity_test() {
args.pollset = static_cast<grpc_pollset*>(gpr_zalloc(grpc_pollset_size()));
grpc_pollset_init(args.pollset, &args.mu);
gpr_event_init(&args.ready);
- gpr_thd_new(&server, bad_server_thread, &args, &options);
+ gpr_thd_new(&server, "gpr_wave_3_server", bad_server_thread, &args, &options);
gpr_event_wait(&args.ready, gpr_inf_future(GPR_CLOCK_MONOTONIC));
for (size_t i = 0; i < NUM_THREADS; ++i) {
- gpr_thd_new(&threads[i], create_loop_destroy, args.addr, &options);
+ gpr_thd_new(&threads[i], "gpr_wave_3", create_loop_destroy, args.addr,
+ &options);
}
for (size_t i = 0; i < NUM_THREADS; ++i) {
gpr_thd_join(threads[i]);
@@ -278,7 +281,8 @@ int run_concurrent_watches_with_short_timeouts_test() {
gpr_thd_options_set_joinable(&options);
for (size_t i = 0; i < NUM_THREADS; ++i) {
- gpr_thd_new(&threads[i], watches_with_short_timeouts, localhost, &options);
+ gpr_thd_new(&threads[i], "gpr_watches_with_short_timeouts",
+ watches_with_short_timeouts, localhost, &options);
}
for (size_t i = 0; i < NUM_THREADS; ++i) {
gpr_thd_join(threads[i]);