GRPC C++  1.26.0
Data Structures | Macros | Functions
tls_pthread.h File Reference
#include <grpc/support/port_platform.h>
#include <grpc/support/log.h>
#include <pthread.h>

Go to the source code of this file.

Data Structures

struct  gpr_pthread_thread_local
 Thread local storage based on pthread library calls. More...
 

Macros

#define GPR_TLS_DECL(name)   static struct gpr_pthread_thread_local name = {0}
 Use GPR_TLS_DECL to declare tls static variables outside a class. More...
 
#define GPR_TLS_CLASS_DECL(name)   static struct gpr_pthread_thread_local name
 Use GPR_TLS_CLASS_DECL to declare tls static variable members of a class. More...
 
#define GPR_TLS_CLASS_DEF(name)   struct gpr_pthread_thread_local name = {0}
 Use GPR_TLS_CLASS_DEF to declare tls static variable members of a class. More...
 
#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_get(tls)   ((intptr_t)pthread_getspecific((tls)->key))
 

Functions

intptr_t gpr_tls_set (struct gpr_pthread_thread_local *tls, intptr_t value)
 

Macro Definition Documentation

◆ GPR_TLS_CLASS_DECL

#define GPR_TLS_CLASS_DECL (   name)    static struct gpr_pthread_thread_local name

Use GPR_TLS_CLASS_DECL to declare tls static variable members of a class.

GPR_TLS_CLASS_DEF needs to be called to define this member.

◆ GPR_TLS_CLASS_DEF

#define GPR_TLS_CLASS_DEF (   name)    struct gpr_pthread_thread_local name = {0}

Use GPR_TLS_CLASS_DEF to declare tls static variable members of a class.

GPR_TLS_CLASS_DEF needs to be called to define this member.

◆ GPR_TLS_DECL

#define GPR_TLS_DECL (   name)    static struct gpr_pthread_thread_local name = {0}

Use GPR_TLS_DECL to declare tls static variables outside a class.

◆ gpr_tls_destroy

#define gpr_tls_destroy (   tls)    pthread_key_delete((tls)->key)

◆ gpr_tls_get

#define gpr_tls_get (   tls)    ((intptr_t)pthread_getspecific((tls)->key))

◆ gpr_tls_init

#define gpr_tls_init (   tls)    GPR_ASSERT(0 == pthread_key_create(&(tls)->key, NULL))

Function Documentation

◆ gpr_tls_set()

intptr_t gpr_tls_set ( struct gpr_pthread_thread_local tls,
intptr_t  value 
)