I have two process on the same machine that communicate via a memory mapped file.
Everything seem ok, except that when one process crash, the other stays waiting forever.
Using the windows api. How does a program know if a process has stopped or crashed?
You can wait for process handles (WaitForSingle/MultipleObject (http://msdn.microsoft.com/en-us/library/windows/desktop/ms687032%28v=vs.85%29.aspx)) and evaluate the process exit code (http://msdn.microsoft.com/en-us/library/windows/desktop/ms683189%28v=vs.85%29.aspx). However, it might be smarter to bring the crashing process into an defined state using an exception handler. In case of a crash you could send an unique message (RegisterWindowMessage (http://msdn.microsoft.com/en-us/library/windows/desktop/ms644947%28v=vs.85%29.aspx)) or use the process return value (ExitProcess).
I forget how to do it, but you can modify the stack and change the GPF message box to your own procedure, I think I posted the code somewhere, but I forget the name.
that sounds like SEH (structured exception handling)
That's crash need more exact defination, as decision could be and SEH handler and terminate process API and mutexes and conditional variables, and may be something else ...
Quote from: xanatose on January 03, 2014, 01:22:38 AMwhen one process crash, the other stays waiting forever.
qWord's proposals work, of course, but you better use Task Manager to kill the hanging process while looking for the design flaw that makes it hang. There is absolutely no valid reason why a process should crash with no warning...