aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/grpc/support
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 /include/grpc/support
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 'include/grpc/support')
-rw-r--r--include/grpc/support/thd.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/include/grpc/support/thd.h b/include/grpc/support/thd.h
index 225d9d6c75..e9444e88c9 100644
--- a/include/grpc/support/thd.h
+++ b/include/grpc/support/thd.h
@@ -42,9 +42,12 @@ typedef struct {
/** Create a new thread running (*thd_body)(arg) and place its thread identifier
in *t, and return true. If there are insufficient resources, return false.
+ thd_name is the name of the thread for identification purposes on platforms
+ that support thread naming.
If options==NULL, default options are used.
The thread is immediately runnable, and exits when (*thd_body)() returns. */
-GPRAPI int gpr_thd_new(gpr_thd_id* t, void (*thd_body)(void* arg), void* arg,
+GPRAPI int gpr_thd_new(gpr_thd_id* t, const char* thd_name,
+ void (*thd_body)(void* arg), void* arg,
const gpr_thd_options* options);
/** Return a gpr_thd_options struct with all fields set to defaults. */