aspose file tools
The moose likes Threads and Synchronization and the fly likes starting a thread twice Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Reply Bookmark "starting a thread twice" Watch "starting a thread twice" New topic
Author

starting a thread twice

Marlene Miller
Ranch Hand

Joined: Mar 05, 2003
Posts: 1391

Output:
been here
false
true
I do not understand why an IllegalThreadStateException does not occur at the second t.start().
Even so, I do not understand why the second t.isAlive() is true.
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18652
Looks like this has been a bug in the JDK's since, well, forever. Last milennium, anyway. See 4773384 for the most up-to-date report I could find. They say it will finally be fixed in 1.5 - but I'll believe it when I see it. :roll:


"I'm not back." - Bill Harding, Twister
Marlene Miller
Ranch Hand

Joined: Mar 05, 2003
Posts: 1391
Thank you Jim for doing the research I should have done. I forgot about the bug database.
They say the JVM treats the second start request as a no-op. It's strange isAlive becomes true.
[ June 30, 2003: Message edited by: Marlene Miller ]
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18652
Yeah, back when I sterted Java with 1.1, about a third of my questions were best answered by checking the bug database. Fortunately nowadays that happens much less frequently; it's easy to forget to check...
 
 
subject: starting a thread twice
 
Threads others viewed
Question on Thread
Dead Thread !!
thread start in k&b
Thread Q from Sierra & Bates SCJP Study Guide
Thread,Join problem
MyEclipse, The Clear Choice