diff options
author | 2015-05-14 16:03:27 -0700 | |
---|---|---|
committer | 2015-05-14 21:37:17 -0700 | |
commit | a33eca933247e1184ced5f035c46817f75776a0b (patch) | |
tree | f2605ad1c9ce757eb5e154dc03397c5ff1ea69f8 /include | |
parent | 7f1e61fb8d9733f18cb735773bfa6e44f4825659 (diff) |
Guarantee tls_set returns the new value
Diffstat (limited to 'include')
-rw-r--r-- | include/grpc/support/tls.h | 2 | ||||
-rw-r--r-- | include/grpc/support/tls_pthread.h | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/include/grpc/support/tls.h b/include/grpc/support/tls.h index 7a7143c6d1..156280e47d 100644 --- a/include/grpc/support/tls.h +++ b/include/grpc/support/tls.h @@ -54,7 +54,7 @@ Destroying a thread local: gpr_tls_destroy(&foo); - Setting a thread local: + Setting a thread local (returns new_value): gpr_tls_set(&foo, new_value); Accessing a thread local: diff --git a/include/grpc/support/tls_pthread.h b/include/grpc/support/tls_pthread.h index 249c4d1cab..07eb12e5bf 100644 --- a/include/grpc/support/tls_pthread.h +++ b/include/grpc/support/tls_pthread.h @@ -47,7 +47,7 @@ struct gpr_pthread_thread_local { #define gpr_tls_init(tls) GPR_ASSERT(0 == pthread_key_create(&(tls)->key, NULL)) #define gpr_tls_destroy(tls) pthread_key_delete((tls)->key) #define gpr_tls_set(tls, new_value) \ - GPR_ASSERT(pthread_setspecific((tls)->key, (void*)(new_value)) == 0) + (GPR_ASSERT(pthread_setspecific((tls)->key, (void*)(new_value)) == 0), (new_value)) #define gpr_tls_get(tls) ((gpr_intptr)pthread_getspecific((tls)->key)) #endif |