aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/grpc
diff options
context:
space:
mode:
Diffstat (limited to 'include/grpc')
-rw-r--r--include/grpc/support/tls_gcc.h7
-rw-r--r--include/grpc/support/tls_msvc.h3
-rw-r--r--include/grpc/support/tls_pthread.h1
3 files changed, 11 insertions, 0 deletions
diff --git a/include/grpc/support/tls_gcc.h b/include/grpc/support/tls_gcc.h
index 019acdf122..170baf82ca 100644
--- a/include/grpc/support/tls_gcc.h
+++ b/include/grpc/support/tls_gcc.h
@@ -37,6 +37,10 @@ struct gpr_gcc_thread_local {
static bool name##_inited = false; \
static __thread struct gpr_gcc_thread_local name = {0, &(name##_inited)}
+#define GPR_TLS_NON_STATIC_DECL(name) \
+ bool name##_inited = false; \
+ __thread struct gpr_gcc_thread_local name = {0, &(name##_inited)}
+
#define gpr_tls_init(tls) \
do { \
GPR_ASSERT(*((tls)->inited) == false); \
@@ -71,6 +75,9 @@ struct gpr_gcc_thread_local {
#define GPR_TLS_DECL(name) \
static __thread struct gpr_gcc_thread_local name = {0}
+#define GPR_TLS_NON_STATIC_DECL(name) \
+ __thread struct gpr_gcc_thread_local name = {0}
+
#define gpr_tls_init(tls) \
do { \
} while (0)
diff --git a/include/grpc/support/tls_msvc.h b/include/grpc/support/tls_msvc.h
index e5f2205fc1..e3a0921912 100644
--- a/include/grpc/support/tls_msvc.h
+++ b/include/grpc/support/tls_msvc.h
@@ -29,6 +29,9 @@ struct gpr_msvc_thread_local {
#define GPR_TLS_DECL(name) \
static __declspec(thread) struct gpr_msvc_thread_local name = {0}
+#define GPR_TLS_NON_STATIC_DECL(name) \
+ __declspec(thread) struct gpr_msvc_thread_local name = {0}
+
#define gpr_tls_init(tls) \
do { \
} while (0)
diff --git a/include/grpc/support/tls_pthread.h b/include/grpc/support/tls_pthread.h
index fb0edd8e74..09768d8423 100644
--- a/include/grpc/support/tls_pthread.h
+++ b/include/grpc/support/tls_pthread.h
@@ -30,6 +30,7 @@ struct gpr_pthread_thread_local {
};
#define GPR_TLS_DECL(name) static struct gpr_pthread_thread_local name = {0}
+#define GPR_TLS_NON_STATIC_DECL(name) struct gpr_pthread_thread_local name = {0}
#define gpr_tls_init(tls) GPR_ASSERT(0 == pthread_key_create(&(tls)->key, NULL))
#define gpr_tls_destroy(tls) pthread_key_delete((tls)->key)