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
Although MSVC is definitely not POSIX compliant, errno
is implemented in the MSVC runtime (at least as of MSVC2008) in a threadsafe manner.
Although the documentation states that it is extern int errno
it's actually implemented as a #define
to 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!