moved memory allocation for tls to `pthread_setspecific()`