aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/surface/completion_queue_threading_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/completion_queue_threading_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/completion_queue_threading_test.cc')
-rw-r--r--test/core/surface/completion_queue_threading_test.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/test/core/surface/completion_queue_threading_test.cc b/test/core/surface/completion_queue_threading_test.cc
index af54e00c4a..17e185d236 100644
--- a/test/core/surface/completion_queue_threading_test.cc
+++ b/test/core/surface/completion_queue_threading_test.cc
@@ -96,7 +96,8 @@ static void test_too_many_plucks(void) {
}
thread_states[i].cc = cc;
thread_states[i].tag = tags[i];
- gpr_thd_new(thread_ids + i, pluck_one, thread_states + i, &thread_options);
+ gpr_thd_new(thread_ids + i, "gpr_test_pluck", pluck_one, thread_states + i,
+ &thread_options);
}
/* wait until all other threads are plucking */
@@ -233,7 +234,7 @@ static void test_threading(size_t producers, size_t consumers) {
options[i].events_triggered = 0;
options[i].cc = cc;
options[i].id = optid++;
- GPR_ASSERT(gpr_thd_new(&id,
+ GPR_ASSERT(gpr_thd_new(&id, i < producers ? "gpr_producer" : "gpr_consumer",
i < producers ? producer_thread : consumer_thread,
options + i, nullptr));
gpr_event_wait(&options[i].on_started, ten_seconds_time());