If I get it correctly, this function cannot be safe as is, due to everyone in a thread implicitely having a reference to TLS. Created this issue because I didn't want discussion about this to be lost in IRC.