Newsgroups : Borland : borland.public.delphi.internet.winsock : 2008 Jun : Re: IdGlobal.SetThreadName using EIdException?
| Subject: | Re: IdGlobal.SetThreadName using EIdException? |
| Posted by: | "Remy Lebeau (TeamB)" (no.spam@no.spam.com) |
| Date: | Fri, 20 Jun 2008 09:55:07 |
"Yahoo Serious" <y.serious@yahoo.com> wrote in message
news:485bb230@newsgroups.borland.com...
> However, Indy's IdGlobal.SetThreadName uses RaiseException(...).
Because it has to. That is a requirement of debuggers. $406D1388 is a
special-case exception code that tells the debugger what the name of the
calling thread is so it can be cached for display purposes. There is no way
to raise $406D1388 other than by calling RaiseException() directly. This
technique for naming threads was introduced by Microsoft, and is used by
both Microsoft and CodeGear debuggers:
How to: Set a Thread Name in Native Code
http://msdn.microsoft.com/en-us/library/xcb2z8hs.aspx
> This Exception seems necessary to do the job.
Yes, it is.
> Like any Exception this does trigger JCL to log the call stack.
I would expect it to if JCL is hooking into the RTL's lower-level exception
handling mechanisms. When the exception is raised, the debugger catches it
first, retreives the provided thread name, and then returns the exception
back to the application for normal handling (which is why Indy has a
try..except around the RaiseException() call), thus triggering JCL's
logging.
> I am wondering whether it is possible to use a 'typed' Exception,
> inheriting from EIdException?
No, it is not possible.
Gambit
none