Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Threads' name can be the same?

 
Nick Widelec
Ranch Hand
Posts: 226
Eclipse IDE Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everybody,
Directly from here: http://docs.oracle.com/javase/7/docs/api/java/lang/Thread.html:
Every thread has a name for identification purposes. More than one thread may have the same name. If a name is not specified when a thread is created, a new name is generated for it.


Do they mean that 2 threads named by the JVM may have the same name after a few numbers? like Thread-0 Thread-1 Thread-2 and then again Thread-0? Or is it referring only to the fact that we can assign manually the same name to different threads?(hope this last one is the reality, otherwise there would not be much sense (at least to me));
Thanks in advance.


 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's the latter (i.e. you can call a Thread whatever you like, including giving two or more Threads the same name). In general the JVM will give them unique names but I don't believe the documentation says specifically that will happen, it's just an implementation detail.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic