Thread.stop()

Patrick Tullmann tullmann at cs.utah.edu
Mon May 22 13:04:32 PDT 2000


Jason Baker wrote:
> Thread.stop is dangerous, but without a process model there is really
> no alternative.  I'm using it to halt infinite loops, which is why I
> need the stack trace.

I'm pretty sure that the official position from Sun is that there is
no way to stop uncooperative threads in a JVM.  According to Sun, you
just restart the whole JVM.

> Both Godmar and Pat use Thread.stop to implement safe termination,
> so given that it is part of Kaffe, what should the call do?

I don't exactly use Thread.stop() in Janos or Alta.  I make sure the
target thread is stopped in a clean spot (not in the kernel, or other
system code) and then just clean it up with a direct jthread_ call.
(Technically, this is just what is *supposed* to happen, neither
system completely implements termination of very uncooperative
threads.)  Godmar's solution is quite similar, I think.

The real problem with Thread.stop() is that it can stop threads when
they're in places like the GC or in the JAR code, and can leave the VM 
in an unstable state.  If you really need to terminate uncooperative
Threads, you're going to have to make sure they're not executing
critical JVM code.

-Pat

----- ----- ---- ---  ---  --   -    -      -         -               -
Pat Tullmann                                       tullmann at cs.utah.edu
		This space unintentionally left blank.


More information about the kaffe mailing list