Skip to content
Snippets Groups Projects
Commit a33eca93 authored by Craig Tiller's avatar Craig Tiller
Browse files

Guarantee tls_set returns the new value

parent 7f1e61fb
No related branches found
No related tags found
No related merge requests found
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
Destroying a thread local: Destroying a thread local:
gpr_tls_destroy(&foo); gpr_tls_destroy(&foo);
Setting a thread local: Setting a thread local (returns new_value):
gpr_tls_set(&foo, new_value); gpr_tls_set(&foo, new_value);
Accessing a thread local: Accessing a thread local:
......
...@@ -47,7 +47,7 @@ struct gpr_pthread_thread_local { ...@@ -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_init(tls) GPR_ASSERT(0 == pthread_key_create(&(tls)->key, NULL))
#define gpr_tls_destroy(tls) pthread_key_delete((tls)->key) #define gpr_tls_destroy(tls) pthread_key_delete((tls)->key)
#define gpr_tls_set(tls, new_value) \ #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)) #define gpr_tls_get(tls) ((gpr_intptr)pthread_getspecific((tls)->key))
#endif #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment