add tls support for hthread