This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: Unblocking blocked I/O
- To: Tom Tromey <tromey at redhat dot com>
- Subject: Re: Unblocking blocked I/O
- From: David Vrabel <dv207 at hermes dot cam dot ac dot uk>
- Date: Wed, 26 Sep 2001 17:45:15 +0100 (BST)
- cc: Bryce McKinlay <bryce at waitaki dot otago dot ac dot nz>, <java at gcc dot gnu dot org>
On 26 Sep 2001, Tom Tromey wrote:
> >>>>> "Bryce" == Bryce McKinlay <bryce@waitaki.otago.ac.nz> writes:
>
> Bryce> * java/io/natFileDescriptorPosix.cc (write (jint)): Check for thread
> Bryce> interrupted status flag only if ::write returned an error.
>
> My understanding is that write(2) can return a short (not -1) count
> when interrupted. From the glibc manual:
>
> `EINTR'
> The `write' operation was interrupted by a signal while it was
> blocked waiting for completion. A signal will not necessary
> cause `write' to return `EINTR'; it may instead result in a
> successful `write' which writes fewer bytes than requested.
>
> This is why the code used to check for the interrupt unconditionally.
> I think this part of the change should be reverted.
With the old way it could throw an exception even if the read/write wasn't
interrupted but if the interrupted flag of the Thread was still set. e.g.
because the interrupt was received before the system call was started.
Since it seems to be inconsistantly implemented I wouldn't have thought it
wouldn't matter greatly how it was done.
David Vrabel