The accompanying code takes care of another application (call it "myApp") that should always be running.
It wakes up every X times, and checks the following:
- Is myApp running? If not, it turns it on.
- Is myApp hanging? (This is decided by myApp not consuming any CPU usage during the last X times and since the previous check.) If yes, kills it and restarts it.
- Is myApp already running for Y time? If yes, kills it and restarts it.
This code was compiled under VC++ 6.0. It needs the following definitions: