Click to See Complete Forum and Search --> : detect thread lockups


bbly
August 24th, 2005, 06:32 AM
My program makes a call into a COM object which is part of a Microsoft service. We have had the occasional problem of this service locking up. this means that my program locks up when it makes a call into the COM object and doesn't return.

I have try/catch around the call but the problem is that it the call never returns.

I was thinking of having another thread watching the first and making sure that it detects when it gets locked up, so that it can kill it.

How can I detect from a second thread whether the first thread is locked up?

wildfrog
August 24th, 2005, 06:40 AM
You cannot, but you can wait for it for a specific amount of time, and if the thread hasn't continued, kill it... it isn't very nice though.

- petter

Ejaz
August 24th, 2005, 07:11 AM
[ Moved Thread ]

Arjay
August 24th, 2005, 12:03 PM
bbly, not sure which MS service you are using but many have an asynchronous mode. Depending on the service, you may be able to make an async call that will allow you to have more control when calling into the service.


Arjay