views:

35

answers:

2

Hello,

I am developping an objective c application and I would like to detect non responsives windows even if they are not own by my application. Is there a way to be notified when a such case occurs?

Thanks in advance for your help,

Regards,

+1  A: 

You can use the Instruments application with a "Spin Monitor" instrument track. If you set it to monitor "All Processes", it will capture stack traces whenever an application hangs (doesn't process the main event loop for a long time).

alt text

Marc Liyanage
+1  A: 

I think the only way to detect whether an window is hanging is to detect when its application is hanging. And I think the only way to - reliably - do this is to talk to it. Send it some inter-process message and await an action. I think that's exactly how the system detects it: there is some delay before the beach ball appears. And this is because the system sent a message and received no answer in x seconds.

What kind of message that might be is hard to say. Must be something that goes through the main event loop but can be sent by every application. I'm sure Google will be of some help finding it. I'm no pro in inter-process communications and would have to search as well.

Max Seelemann
Thanks for the idea, I will continue to seach that way.
AP