public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
From: "thebohemian at gmx dot net" <gcc-bugzilla@gcc.gnu.org>
To: java-prs@gcc.gnu.org
Subject: [Bug libgcj/20509] New: inline function _Jv_Select could return error code instead of throwing exception
Date: Thu, 17 Mar 2005 05:04:00 -0000	[thread overview]
Message-ID: <20050317033119.20509.thebohemian@gmx.net> (raw)

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


             reply	other threads:[~2005-03-17  3:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-17  5:04 thebohemian at gmx dot net [this message]
2005-03-17  5:05 ` [Bug libgcj/20509] " pinskia at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050317033119.20509.thebohemian@gmx.net \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=java-prs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).