C Thread safe locale/encoding when using sprintf and printf
You cannot safely use setlocale
at all in a program once it becomes multithreaded. If you need multiple locales, you need the newlocale
/uselocale
API for thread-local or first-class locale objects, not setlocale
.