use pthread_getspecific instead of __thread