Thread.interrupt()

Miles Sabin msabin@cromwellmedia.co.uk
Wed Mar 15 11:57:00 GMT 2000


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/


More information about the Java mailing list