aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar Vijay Pai <vpai@google.com>2017-12-05 19:00:11 -0800
committerGravatar GitHub <noreply@github.com>2017-12-05 19:00:11 -0800
commit9dbb6e3a28ae9c5ed3c97913c4c363b15eb7b2cc (patch)
tree6a657f8c6179d873b34505cdc24bce9462ca68eb /include
parent08aa228771c639a20e45e47120e1c667d8ac7344 (diff)
parent30ccc944d659a9314f717c9fff582d917420656a (diff)
Merge pull request #13559 from dmaclach/threadnames
Add thread naming support on platforms that support it.
Diffstat (limited to 'include')
-rw-r--r--include/grpc/impl/codegen/port_platform.h2
-rw-r--r--include/grpc/support/thd.h5
2 files changed, 6 insertions, 1 deletions
diff --git a/include/grpc/impl/codegen/port_platform.h b/include/grpc/impl/codegen/port_platform.h
index 1906886d5e..5a0ed85111 100644
--- a/include/grpc/impl/codegen/port_platform.h
+++ b/include/grpc/impl/codegen/port_platform.h
@@ -173,6 +173,7 @@
#endif /* _LP64 */
#ifdef __GLIBC__
#define GPR_POSIX_CRASH_HANDLER 1
+#define GPR_LINUX_PTHREAD_NAME 1
#else /* musl libc */
#define GPR_MUSL_LIBC_COMPAT 1
#endif
@@ -195,6 +196,7 @@
#else /* __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_7 */
#define GPR_CPU_POSIX 1
#define GPR_GCC_TLS 1
+#define GPR_APPLE_PTHREAD_NAME 1
#endif
#else /* __MAC_OS_X_VERSION_MIN_REQUIRED */
#define GPR_CPU_POSIX 1
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. */