[concurrency-interest] Does "Thread.stop" do what is says it does?

Dawid Kurzyniec dawidk at mathcs.emory.edu
Thu Aug 4 14:17:16 EDT 2005


Dawid Kurzyniec wrote:

> The javadoc of Thread.stop says:
>
>     * It is permitted to stop a thread that has not yet been started.
>     * If the thread is eventually started, it immediately terminates.
>
> However, the first statement of Thread.stop is:
>
>            if (!this.isAlive()) return;
>
> And isAlive javadoc says:
>
>     * Tests if this thread is alive. A thread is alive if it has
>     * been started and has not yet died.
>
> This seems to imply that stop is a no-op on a thread that has not yet 
> started, and I can't see why the thread would be terminated as soon as 
> it starts. So what's the deal here?

Replying to myself: the observed behavior seems to be that stop followed 
by start does not cause immediate thread termination, so I guess I 
report it here as a bug. (I guess it should be "if (this.getState() == 
TERMINATED) return;" or something equivalent).

Regards,
Dawid



More information about the Concurrency-interest mailing list