Thread Description

delphi package - automated exception handling
Post Reply
frogb
Posts: 3
Joined: Sun Jul 19, 2015 3:48 pm

Thread Description

Post by frogb »

It would be really helpful to have thread descriptions available in bugreport.txt.

I can set this using the Windows 10 API:
https://docs.microsoft.com/en-us/window ... escription

Where in the MadExcept source code is the best place a place to add GetThreadDescription to display it alongside the Thread ID ?
frogb
Posts: 3
Joined: Sun Jul 19, 2015 3:48 pm

Re: Thread Description

Post by frogb »

I have now found SetThreadInfo and made a change to add it to the implementation section of madExcept.pas so that I can call it after creating threads. The ones I need to show in bugreport.txt are actually created in a Microsoft C DLL which can already call some functions in the main Delphi program. This works well!
madshi
Site Admin
Posts: 10341
Joined: Sun Mar 21, 2004 5:25 pm

Re: Thread Description

Post by madshi »

There's already an API exported by madExcept.pas called "NameThread()":

Code: Select all

// to make the bug report more readable, you can name your secondardy threads
procedure NameThread (threadId: dword; const threadName: UnicodeString);
Internally it calls "SetThreadInfo".
frogb
Posts: 3
Joined: Sun Jul 19, 2015 3:48 pm

Re: Thread Description

Post by frogb »

Thanks, that's easier!
Post Reply