Thread.interrupt

Bryce McKinlay bryce@albatross.co.nz
Wed Jan 17 14:51:00 GMT 2001


Tom Tromey wrote:
> I looked at this a bit today. I tried the appended program, which I
> think should cause the new thread to throw InterruptedIOException.

Well, your test program doesn't look quite right. It never actually
starts the thread "q", and even if it did the thread would be finished by
the time interrupt() is called on it. I tried changing the println() loop
to a single System.in.read(), and changing q.run() to q.start(), but the
interrupt call still didn't do anything. Perhaps the JDK's interrupt
doesn't work for the stdio streams - only for sockets and file
operations.
regards
 [ bryce ]


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /