Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way to name external threads?

TThread.NameThreadForDebugging is great for telling threads apart, but not all of my threads are TThread descendants. I have some that are created by an external library that's not even written in Delphi. Is there any way to name them if I can find a way to get their thread handles?

like image 550
Mason Wheeler Avatar asked Dec 06 '25 06:12

Mason Wheeler


1 Answers

See this MSDN article: How to: Set a Thread Name in Native Code

This works for Visual Studio. I don't know whether the Delphi debugger will pick up the name.

Note that you need the thread ID rather than the thread handle.

like image 70
Kristopher Johnson Avatar answered Dec 08 '25 19:12

Kristopher Johnson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!