re PR libgcj/1351 (_Jv_select -vs- Thread.interrupt)
authorTom Tromey <tromey@redhat.com>
Tue, 13 Feb 2001 18:44:51 +0000 (18:44 +0000)
committerTom Tromey <tromey@gcc.gnu.org>
Tue, 13 Feb 2001 18:44:51 +0000 (18:44 +0000)
Fix for PR libgcj/1351:
* posix.cc (_Jv_select): Throw InterruptedIOException if thread is
interrupted.
Include Thread.h and InterruptedIOException.h.

From-SVN: r39639

libjava/ChangeLog
libjava/posix.cc

index f92645a65694f07f1df788fddd601937c7d7473c..9201d268ffeeaad3ac36f45d38a234d110d3d033 100644 (file)
@@ -1,3 +1,10 @@
+2001-02-13  Tom Tromey  <tromey@redhat.com>
+
+       Fix for PR libgcj/1351:
+       * posix.cc (_Jv_select): Throw InterruptedIOException if thread is
+       interrupted.
+       Include Thread.h and InterruptedIOException.h.
+
 2001-02-13  Bryce McKinlay  <bryce@albatross.co.nz>
 
        * java/io/BlockDataException.java: Removed.
index d470a644da3c9d92c31a606f65a3c9baf59d4863..1f5b037f704b0b07d53cab9e24834e498b826b87 100644 (file)
@@ -1,6 +1,6 @@
 // posix.cc -- Helper functions for POSIX-flavored OSs.
 
-/* Copyright (C) 2000  Free Software Foundation
+/* Copyright (C) 2000, 2001  Free Software Foundation
 
    This file is part of libgcj.
 
@@ -14,6 +14,10 @@ details.  */
 
 #include <errno.h>
 
+#include <jvm.h>
+#include <java/lang/Thread.h>
+#include <java/io/InterruptedIOException.h>
+
 #if defined (ECOS)
 extern "C" unsigned long long _clock (void);
 #endif
@@ -76,6 +80,10 @@ _Jv_select (int n, fd_set *readfds, fd_set  *writefds,
       if (r != -1 || errno != EINTR)
        return r;
 
+      // Here we know we got EINTR.
+      if (java::lang::Thread::interrupted ())
+       throw new java::io::InterruptedIOException (JvNewStringLatin1 ("select interrupted"));
+
       struct timeval after;
       if (timeout)
        {