thr_keycreate() allocates a key that is used to identify thread-specific data in a process.
#include <thread.h> int thr_keycreate(thread_key_t *keyp, void (*destructor) (void *value));