The GNU C Library implements functions to allow users to create and manage data specific to a thread. Such data may be destroyed at thread exit, if a destructor is provided. The following functions are defined:
int pthread_key_create (pthread_key_t *key, void (*destructor)(void*))Objects declared with the C++11 thread_local keyword are destroyed
before thread-specific data, so they should not be used in thread-specific
data destructors or even as members of the thread-specific data, since the
latter is passed as an argument to the destructor function.
int pthread_key_delete (pthread_key_t key)void *pthread_getspecific (pthread_key_t key)int pthread_setspecific (pthread_key_t key, const void *value)