Add TLS implementation
Fix and refactor Win32 TLS support
Fix flipped boolean argument