[2512] in java-interest
Re: thread "cancels" of blocked threads
daemon@ATHENA.MIT.EDU (Arthur van Hoff)
Tue Oct 3 22:16:26 1995
Date: Tue, 3 Oct 1995 16:34:18 -0700
From: Arthur.Vanhoff@Eng.Sun.COM (Arthur van Hoff)
To: caveh@updoc-39.Eng.Sun.COM
Cc: java-interest@java.Eng.Sun.COM
Hi,
> how do you cancel a thread? i'm currently using the Thread.stop()
> method, but the target thread is blocked on a Socket.read() and
> aparently can't be cancelled at that point. closing the Socket also
> doesn't seem to unblock the Socket.read().
This is a problem that we'll be solving in upcoming releases. The idea
is that you should be able to break out of a blocking call by interrupting
a thread using Thread.interrupt(). The blocking call will be terminated
with an InterruptedException and a flag in the thread and Thread.interrupted()
will be true. The thread should then be given a change to cooperatively
terminate. If that fails you can try Thread.stop() which will throw
a ThreadDeath exception.
We unfortunately didn't have time to finish this before the release went
out.
Have fun,
Arthur van Hoff
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com