
Niall Douglas wrote:
In an exception handler you cannot call any async unsafe routine such as anything in MSVCRT nor anything implemented by kernel32.dll in userspace. As on POSIX, almost all syscalls implemented entirely in kernel space are safe.
Thanks Niall. Do you know which Windows API functions are safe and which aren't? I couldn't find a list anywhere.
Antony makes the valid point that on Windows there are race problems with the DbgHelp library, in fact not only is it not async-unsafe, it's also thread-unsafe.
He doesn't use DbgHelp in the Windows backend though, he uses Dbgeng.h. This is not the same thing, I think?
Of course Windows has signals, as already referred to by myself earlier it's called vectored exception handling which is exactly the same as a signal implementation.
Not quite. A signal immediately suspends the thread and calls the handler in it. Windows exception handling, in contrast, unwinds the stack. So if the kernel crashes somewhere deep, it can unwind itself to a usable state before the program gets to handle the exception. Or at least that's my understanding.