News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

How does one know if a process has stopped or crash?

Started by xanatose, January 03, 2014, 01:22:38 AM

Previous topic - Next topic

xanatose

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?

qWord

You can wait for process handles (WaitForSingle/MultipleObject) and evaluate the process exit code. 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) or use the process return value (ExitProcess).
MREAL macros - when you need floating point arithmetic while assembling!

Farabi

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.
http://farabidatacenter.url.ph/MySoftware/
My 3D Game Engine Demo.

Contact me at Whatsapp: 6283818314165

dedndave

that sounds like SEH (structured exception handling)

Adamanteus

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 ...

jj2007

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...