Is errno on MSVC thread-safe?
According to the answers in this question POSIX requires that errno is thread-safe. But MSVC is probably not POSIX compliant and MSDN does not tell anything about thread-safety. MSDN contradictory mentions that errno is declared as extern int errno;, but also as #define errno (*_errno())
Although MSVC is definitely not POSIX compliant,
errnois implemented in the MSVC runtime (at least as of MSVC2008) in a threadsafe manner.Although the documentation states that it is
extern int errnoit’s actually implemented as a#defineto a function which allows thread-safety to be imposed. If you step through this function in the disassembly window, it is clear that thread local storage is used.Sadly I can’t point to any official documentation that confirms this but such is life!