Patch: fix for PR libgcj/1351

Tom Tromey tromey@redhat.com
Tue Feb 13 10:43:00 GMT 2001


I'm checking this in.  I don't think it is important enough to go on
the branch, given that Thread.interrupt() doesn't currently work
anyway.

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.

Tom

Index: posix.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/posix.cc,v
retrieving revision 1.1
diff -u -r1.1 posix.cc
--- posix.cc	2000/08/02 21:54:04	1.1
+++ posix.cc	2001/02/13 18:41:08
@@ -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 @@
 
 #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
@@ -75,6 +79,10 @@
 		      timeout ? &delay : NULL);
       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)



More information about the Java-patches mailing list