This is the mail archive of the
java-discuss@sourceware.cygnus.com
mailing list for the Java project.
RE: Thread.interrupt()
- To: java-discuss at sourceware dot cygnus dot com
- Subject: RE: Thread.interrupt()
- From: Miles Sabin <msabin at cromwellmedia dot co dot uk>
- Date: Wed, 15 Mar 2000 19:57:24 -0000
Boehm, Hans wrote,
> The crucial problem with this is that at least every class in
> the system that performs blocking I/O has to play by these
> rules.
The same applies to Thread.interrupt().
Interrupts can be cleared or deferred indefinitely, so Thread.
interrupt() isn't a guaranteed way of cancelling a thread which
doesn't respect the protocol.
Much the same goes for the complaint that resource revocation
violates encapsulation: if it's unexpected an interrupt
represents a pretty violent disruption of control flow.
Of course an interrupt isn't always unexpected, but then
neither is resource revocation.
Cheers,
Miles
--
Miles Sabin Cromwell Media
Internet Systems Architect 5/6 Glenthorne Mews
+44 (0)20 8817 4030 London, W6 0LJ, England
msabin@cromwellmedia.com http://www.cromwellmedia.com/