+2001-09-20 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
+
+ * posix-threads.cc (_Jv_ThreadInterrupt): Re-enable interrupt of
+ blocking IO via pthread_kill().
+ * java/io/natFileDescriptorPosix.cc (write (jint)): Check for thread
+ interrupted status flag only if ::write returned an error.
+ (write (jbyteArray, jint, jint): Likewise.
+ (read (jint)): Likewise.
+ (read (jbyteArray, jint, jint): Likewise.
+
2001-09-19 Anthony Green <green@redhat.com>
* gnu/gcj/protocol/file/Handler.java: Avoid NullPointerException
while (r != 1)
{
r = ::write (fd, &d, 1);
- if (java::lang::Thread::interrupted())
- {
- InterruptedIOException *iioe
- = new InterruptedIOException (JvNewStringLatin1 ("write interrupted"));
- iioe->bytesTransferred = r == -1 ? 0 : r;
- throw iioe;
+ if (r == -1)
+ {
+ if (java::lang::Thread::interrupted())
+ {
+ InterruptedIOException *iioe
+ = new InterruptedIOException (JvNewStringLatin1 (strerror (errno)));
+ iioe->bytesTransferred = r == -1 ? 0 : r;
+ throw iioe;
+ }
+ throw new IOException (JvNewStringLatin1 (strerror (errno)));
}
- else if (r == -1)
- throw new IOException (JvNewStringLatin1 (strerror (errno)));
}
}
while (len > 0)
{
int r = ::write (fd, bytes, len);
- if (r != -1)
- written += r;
- if (java::lang::Thread::interrupted())
- {
- InterruptedIOException *iioe
- = new InterruptedIOException (JvNewStringLatin1 ("write interrupted"));
- iioe->bytesTransferred = written;
- throw iioe;
+ if (r == -1)
+ {
+ if (java::lang::Thread::interrupted())
+ {
+ InterruptedIOException *iioe
+ = new InterruptedIOException (JvNewStringLatin1 (strerror (errno)));
+ iioe->bytesTransferred = written;
+ throw iioe;
+ }
+ throw new IOException (JvNewStringLatin1 (strerror (errno)));
}
- else if (r == -1)
- throw new IOException (JvNewStringLatin1 (strerror (errno)));
+ written += r;
len -= r;
bytes += r;
}
int r = ::read (fd, &b, 1);
if (r == 0)
return -1;
- if (java::lang::Thread::interrupted())
+ if (r == -1)
{
- InterruptedIOException *iioe
- = new InterruptedIOException (JvNewStringLatin1 ("read interrupted"));
- iioe->bytesTransferred = r == -1 ? 0 : r;
- throw iioe;
+ if (java::lang::Thread::interrupted())
+ {
+ InterruptedIOException *iioe
+ = new InterruptedIOException (JvNewStringLatin1 (strerror (errno)));
+ iioe->bytesTransferred = r == -1 ? 0 : r;
+ throw iioe;
+ }
+ throw new IOException (JvNewStringLatin1 (strerror (errno)));
}
- else if (r == -1)
- throw new IOException (JvNewStringLatin1 (strerror (errno)));
return b & 0xFF;
}
int r = ::read (fd, bytes, count);
if (r == 0)
return -1;
- if (java::lang::Thread::interrupted())
- {
- InterruptedIOException *iioe
- = new InterruptedIOException (JvNewStringLatin1 ("read interrupted"));
- iioe->bytesTransferred = r == -1 ? 0 : r;
- throw iioe;
+ if (r == -1)
+ {
+ if (java::lang::Thread::interrupted())
+ {
+ InterruptedIOException *iioe
+ = new InterruptedIOException (JvNewStringLatin1 (strerror (errno)));
+ iioe->bytesTransferred = r == -1 ? 0 : r;
+ throw iioe;
+ }
+ throw new IOException (JvNewStringLatin1 (strerror (errno)));
}
- else if (r == -1)
- throw new IOException (JvNewStringLatin1 (strerror (errno)));
return r;
}