Link to home
Start Free TrialLog in
Avatar of mrwad99
mrwad99Flag for United Kingdom of Great Britain and Northern Ireland

asked on

AfxBeginThread and Thread ID

Ah hello.

I am creating a thread via AfxBeginThread, and I would like to know how I can get hold of the ID of the thread.  I can obviously assign some data structure to the thread that contains some identifier, but I would like to know the correct way to get the ID.

Any ideas ?

TIA
ASKER CERTIFIED SOLUTION
Avatar of AlexFM
AlexFM

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mrwad99

ASKER

Thanks.  And I can rely on the fact that each thread will have a *completely unique* ID, yes ?
Avatar of AlexFM
AlexFM

Every thread has unique ID among currrently running threads. Otherwise OpenThread API could open wrong thread.
I don't know whether created thread ID can be equal to ID of thread which finished some time before.
Avatar of AndyAinscow
<I don't know whether created thread ID can be equal to ID of thread which finished some time before.>

I suspect it *could* be - Why should windows need to keep track of non-existant threads?
Avatar of mrwad99

ASKER

Thanks AlexFM.  Andy: interesting, worth keeping in mind.

If anyone is interested, I have a stinker of a problem at http:Q_21802368.html on a similar slant to this one