On Mon, 23 Nov 1998 09:47:39 +0300, Pavel Tolkachev wrote:

>> Right.  Sleeping and blocking I/O are interrupted by the interrupt
>> mechanism; when this happens, the I/O methods and the sleep method
>> throw an appropriate exception that tells you it is interrupted.
>
>I/O methods do not throw, at least not on NT Sun's JDKs and API
>documentation does not state they must. Sorry for repeating posting but
>this is my test case from message posted earlier to this thread. Please
>try it on Linux with native threads if possible: 
>
>---------
>Well, as my testing has shown even stop() function does not stop thread
>waiting IO (I tested on NT Sun's JDK 1.1.7 though). I do not feel it is
>thread API design disadvantage; sooner it is drawback of java.io API. My
>common sense tells me: there is no way to stop thread "in correct
>manner" if it has no provisions for this. InputStream makes you to poll
>available() function for non-blocking read. Probably my testing code
>will give you some assistance in your problem:

It is hard to have stop() work during blocking I/O on native threaded
systems since the native threading and I/O blocking may not have a way
to cleanly "break" out of the blocked I/O state.  The only option may
be to kill the process (or thread) at a OS level and thus you would
have a problem of not being able to clean up.

The whole Thread.stop() thing is very nasty in non-green-thread systems.
The core OS may not support the needed mechanisms to cleanly stop a thread
at various points (such as during a blocked I/O)

Michael Sinz -- Director of Research & Development, NextBus Inc.
mailto:[EMAIL PROTECTED] --------- http://www.nextbus.com
My place on the web ---> http://www.users.fast.net/~michael_sinz

Reply via email to