The function _Jv_Select from posix.cc contains the following fragment: // Here we know we got EINTR. if (java::lang::Thread::interrupted ()) throw new java::io::InterruptedIOException (JvNewStringLatin1 ("select interrupted"));
A typical use of _Jv_Select is in natSelectorImplPosix.cc where the method gnu::java::nio::VMSelector::select tests whether the InterruptedIOException has been thrown like this: // Actually do the select try { result = _Jv_select (max_fd + 1, &read_fds, &write_fds, &except_fds, time_data); } catch (::java::io::InterruptedIOException *e) { ::java::lang::Thread::currentThread ()->interrupt (); } However this could be implemented in a more efficient way by using a special return code in _Jv_Select: if (java::lang::Thread::interrupted ()) return SPECIAL; and for gnu::java::nio::VMSelector::select: result = _Jv_select (max_fd + 1, &read_fds, &write_fds, &except_fds, time_data); if(result == SPECIAL) { ::java::lang::Thread::currentThread ()->interrupt (); ... } (the exception has to be swallowed for this method anyway!) Other methods that use _Jv_Select may decide to throw the exception instead. SPECIAL might be set to EINTR. -- Summary: inline function _Jv_Select could return error code instead of throwing exception Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: enhancement Priority: P2 Component: libgcj AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: thebohemian at gmx dot net CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20509