public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgcj/20509] New: inline function _Jv_Select could return error code instead of throwing exception
@ 2005-03-17  5:04 thebohemian at gmx dot net
  2005-03-17  5:05 ` [Bug libgcj/20509] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: thebohemian at gmx dot net @ 2005-03-17  5:04 UTC (permalink / raw)
  To: java-prs

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug libgcj/20509] inline function _Jv_Select could return error code instead of throwing exception
  2005-03-17  5:04 [Bug libgcj/20509] New: inline function _Jv_Select could return error code instead of throwing exception thebohemian at gmx dot net
@ 2005-03-17  5:05 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-03-17  5:05 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-03-17 05:02 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-03-17 05:02:46
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20509


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-03-17  5:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-17  5:04 [Bug libgcj/20509] New: inline function _Jv_Select could return error code instead of throwing exception thebohemian at gmx dot net
2005-03-17  5:05 ` [Bug libgcj/20509] " pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).