madExcept and indy threads
madExcept and indy threads
Does madexcept work in Indy threads?
Mark
Mark
I've not worked with Indy threads yet, so I'm not sure. It depends on whether the Indy threads manually catch exceptions or whether they leave the exception handling to Delphi's default. In the first case madExcept might not automatically take over the exception handling. In the latter case it will automatically catch&handle the exceptions. In the first case: Can you ask the Indy threads to notify you about exceptions? Then you can make it work quite easily.
MadExcept does not work in the indy threads of my application (it does work in my own thread classes that are derived from TThread). However the TidThread (indy thread) is a derived class of TThread the indy threads probably catches itself the exception.
I do not know what you exactly mean with notify but the indy thread has an onException event. Can I use that by retrieving the exception call stack?
BTW, I use Borland C++ Builder 6
Thanks,
Mark
I do not know what you exactly mean with notify but the indy thread has an onException event. Can I use that by retrieving the exception call stack?
BTW, I use Borland C++ Builder 6
Thanks,
Mark
Re:
I know this is an old discussion. I'm just adding this for future reference.
Indy's TIdThread class does indeed have a try..except in its overridden Execute() method to catch all exceptions. It does not let Delphi's default mechanism handle them.
TIdThread passes the caught Exception to TIdThread.DoException(), which is virtual.
The base TIdThread.DoException() fires the TIdThread.OnException event. The wrapper TIdThreadComponent uses this to fire its own OnException event.
A derived class, TIdThreadWithTask, is used by TIdTCPServer, overriding TIdThread.DoException() to fire the TIdTCPServer.OnException event.