Avoid crash on program exit on Windows
Use a thread-local POD instead of an object with non-trivial destructor.