c# - Detect if child GUI is hung from a parent process -


in application there parent process spawns children. trying leverage parent process watch on children ensure gui remains responsive, , if not, generate dump file.

the problem i'm running process.responding detecting gui hangs (such sleeping on gui thread or stack overflow) not others (such deadlocks on gui thread).

so question is: how else can check whether or not gui of child still updating parent process?

edit: based on comments far guess should clarify. responsible maintaining framework of application plugin architecture heavily multi-threaded , has code base of hundreds of thousands of lines of code, of outside control. while understand ideal approach not hang in first place, still happens on occasion. these situations gracefully , collect debug information along way issue can addressed.

another approach i've considered using gui thread touch file , have parent process check time stamp of file. however, i'd rather not perform file operations on gui thread.

after few failed attempts strategies mentioned above, here's how ended solving this:

  1. at child application start save reference gui thread
  2. a timer started periodically checks thread state of gui thread (about every 200ms). if threadstate.running, report process responding parent through inter-process communication.
  3. in parent process keep dictionary of process ids , time process last reported responding. if child still alive hasn't reported responding result within timeout period, user notified process not responding.

so far, seems working expect to.


Comments

Popular posts from this blog

matlab - error with cyclic autocorrelation function -

django - (fields.E300) Field defines a relation with model 'AbstractEmailUser' which is either not installed, or is abstract -

c# - What is a good .Net RefEdit control to use with ExcelDna? -