![]() |
MFC C++ Naming threads for debugger
Inside MS Dev Studio 2003.net when you are debugging and looking at the threads window. The name of most of the threads is "_threadstartex". Is there a way to assign a useful name to the thread so I can very quickly look in this window and figure out what the threads are? Thanks
|
I'm assuming the app you are developing is .NET and not, say a regular console/C++ app using windows threads. On the Thread class there is a property called "name". I would think that MS/VS would use this property for display purposes, but I haven't done enough .NET programming to know for sure.
http://msdn.microsoft.com/library/de...mberstopic.asp |
It is unmanaged C++ and I am using AfxBeginThread to start the worker threads. I have 100's of threads running and it would be nice to scan the threads window and look at the names to determine which thread it is.
|
Quote:
Quote:
CWinThread * pThread = AfxBeginThread(...); SetThreadName(pThread->m_nThreadID, "Foo"); edit: fixed a typo in the doc: the line info.dwThreadID = dwThreadID; was originally info.dwThreadID = dwThread; but that's obviously a compiler error since there is no variable dwThread. |
Thanks, that worked, and it so well documented by Microsoft too.
|
All times are GMT -8. The time now is 06:34 AM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project