pthread_key_create destructor not getting called
问题 As per pthread_key_create man page we can associate a destructor to be called at thread shut down. My problem is that the destructor function I have registered is not being called. Gist of my code is as follows. static pthread_key_t key; static pthread_once_t tls_init_flag = PTHREAD_ONCE_INIT; void destructor(void *t) { // thread local data structure clean up code here, which is not getting called } void create_key() { pthread_key_create(&key, destructor); } // This will be called from every