Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to identify Thread

Status
Not open for further replies.

Rodie

Programmer
Jun 27, 2004
132
FR
Hi !

I don't have Java 5, so I don't have "Thread.getId()". So how can I identify my Thread ?

There is "Thread.getName()" but it seems not to respect unicity no ? It returns "Thread-0", after "Thread-1" ... hmm

Thanks for your help ;)
 
// I think you cannot guarantee thread sequence when the threads are being run. You can use semaphore in your thread class for coordinating the behaviour of comsumer thread and producer thread. You can also use wait and notify technique.
 
What's wrong with giving your Threads explicit names of your choosing when you create them?

Tim
---------------------------
"Your morbid fear of losing,
destroys the lives you're using." - Ozzy
 
Indeed, I finally assign a name to the Thread after creating it. I have only 3 threads, so it's ok :)

Thanks to both of u.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top