Advertisement

05.09.2008 at 09:19AM PDT, ID: 23389984 | Points: 250
[x]
Attachment Details
Thread name
Does anyone know is there anyway to reterive a Thread Name

e.g. GetThreadname
Start your free trial to view this solution
Question Stats
Zone: Microsoft
Question Asked By: FORNOW
Question Asked On: 05.09.2008
Participating Experts: 3
Points: 250
Views: 0
Translate:
Loading Advertisement...
05.09.2008 at 09:32AM PDT, ID: 21534470

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.09.2008 at 09:43AM PDT, ID: 21534579

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.09.2008 at 09:59AM PDT, ID: 21534713

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.09.2008 at 03:35PM PDT, ID: 21536801

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.11.2008 at 02:13AM PDT, ID: 21541915

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.11.2008 at 02:42AM PDT, ID: 21541962

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.11.2008 at 10:39AM PDT, ID: 21543025

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.11.2008 at 10:41AM PDT, ID: 21543031

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.11.2008 at 12:23PM PDT, ID: 21543226

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.11.2008 at 02:50PM PDT, ID: 21543619

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.11.2008 at 03:42PM PDT, ID: 21543790

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.11.2008 at 03:50PM PDT, ID: 21543813

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.11.2008 at 04:07PM PDT, ID: 21543857

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.11.2008 at 10:23PM PDT, ID: 21544787

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.12.2008 at 12:15AM PDT, ID: 21545080

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.12.2008 at 09:19AM PDT, ID: 21548253

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Handhelds / PDAs
  • Displays / Monitors
  • Components
  • Networking Hardware
  • Peripherals
  • Laptops/Notebooks
  • Storage
  • Servers
  • Desktops
  • New Users
  • Misc
  • Apple
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMWare
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMWare
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Community Advisor
  • Lounge
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • Community Advisor
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
05.09.2008 at 09:32AM PDT, ID: 21534470
IMHO a thread has no attribute like name. Maybe ID retrieved with GetThreadId() is good enough?
 
05.09.2008 at 09:43AM PDT, ID: 21534579
>> Does anyone know is there anyway to reterive a Thread Name
Threads don't  have names. Theads are just paths of execution in a process, each with its own context (state info). If you want it to have a name you'll need to give it a name when you spin it... passing it into the threadproc (or thread functor) as userdata.
 
05.09.2008 at 09:59AM PDT, ID: 21534713

Rank: Guru

Thread don't have names but Thread-class objects do (.Name property). Just in case you have created a thread with this .net class, you can get a reference to the objects and recover the name.
 
05.09.2008 at 03:35PM PDT, ID: 21536801
The reason I ask Becuae in the DLL that is called I would line to know which thread I am processing

in The DLL_THEAD_ATTACH when i go throght VS  debugger I execute the CreateThread get the dwThreaid before conrol is trasnfered to the DLL and subsequently DLL_THREAD_ATTACH

iI figure if there was someway I could indentify the thread before DLL and DLL_THREAD_ATTACH message is execured I could identify the thread  
 
05.11.2008 at 02:13AM PDT, ID: 21541915
Well, as roytal eluded, threads have ids so you could use that or, as I stated above, if you need some specific format you can name them yourself by passing in the name as user data when you start the thread.
 
05.11.2008 at 02:42AM PDT, ID: 21541962
If by UserData you mean pass it to the started thread function specfied on the CreateThread or in my Case I apoligize _beginthreadex (as the C++ DLL which I am writting is for  a C app) and i guess uses the CRT (C run time library) that gets executed (the started function) after the DLL_THREAD_ATTACH message has been processed

I need something I can do wih the threadid as that is returned to me before DLL_THREAD_ATTACH message is processed
 
05.11.2008 at 10:39AM PDT, ID: 21543025
>>  need something I can do wih the threadid as that is returned to me before DLL_THREAD_ATTACH message is processed
Then why not just use GetCurrentThreadId Function?

http://msdn.microsoft.com/en-us/library/ms683183.aspx
 
05.11.2008 at 10:41AM PDT, ID: 21543031
>> Then why not just use GetCurrentThreadId Function?
Of course, once a thread is terminated the thread ID can be recycled so you cannot assume it will be unique for the life of the process only the life of the thread!
 
05.11.2008 at 12:23PM PDT, ID: 21543226
I tried GetCurrentThread and from there walking the Stack via VIa StackWalk unfortunatlly I ended

up going all the way to KiApcDispatch a APC type call meaning Async Procedure Call

That sort of kills the stack chain \\

was looking for another way to identify the thread if I have the threadid I figured I could set the thread name via SetthreadName and in DLL_THREAD_ATTACH  somehow reterive un fortunatly it doesn't look doable what I want to do
 
05.11.2008 at 02:50PM PDT, ID: 21543619
Did you try GetCurrentThreadId () like I suggested? If that doesn't work you are really out of options I think.
 
05.11.2008 at 03:42PM PDT, ID: 21543790
I have many threads Just want to Process a few

I get the threaid before contol is transfered to the DLL via DLL_THREAD_ATTACH

the only way I can think of doing what I want is Doing some low level API's

PsAGetThreadByThreaid of course for this I have to raise to IRQL level getting the  TLS array pointer in the ETHREAD block maybe setting the name there
 
05.11.2008 at 03:50PM PDT, ID: 21543813
>> the only way I can think of doing what I want is Doing some low level API's

Ok, I shall ask you one last time before I abandon this question...

*** Did you try GetCurrentThreadId () like I suggested? ***
 
05.11.2008 at 04:07PM PDT, ID: 21543857
The GetCurrentThreadId works but it does nothing for me its just a number

I have few threads I am looking to somehow identify them
 
05.11.2008 at 10:23PM PDT, ID: 21544787
>> The GetCurrentThreadId works but it does nothing for me its just a number
Ok, well that is about as good as it gets... there is no other way to identify a thread unless you name it yourself.
 
05.12.2008 at 12:15AM PDT, ID: 21545080
>> well that is about as good as it gets
You could use a map of thread id to thread name. This map would need to be visible to all threads and would need protecting via a mutex to prevent race conditions when accessing it. The idea is that when you spin up a thread you start it in a wait state, you (from the parent) insert the id and the name into the map and then unwait the thread. When the thread needs to know its name it can refer to the map. When the thread terminates it should remove its entry from the map.

http://www.cplusplus.com/reference/stl/map/
 
05.12.2008 at 09:19AM PDT, ID: 21548253
What can I do with a threadid I have that before control id transfered to DLL_THREAD_ATTACH

The TLS functions e.g. alloc, get and set all work in the context of the current thread can I use the TLS functions for another thread If I have the threadid that would help  
 
 
20080236-EE-VQP-29 / EE_QW_2_20070628