public inbox for mauve-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Archie Cobbs <archie@dellroad.org>
To: Sascha Brawer <brawer@dandelis.ch>
Cc: mauve-discuss@sources.redhat.com, commit-classpath@gnu.org
Subject: Re: Mauve patch
Date: Tue, 06 Apr 2004 14:08:00 -0000	[thread overview]
Message-ID: <200404061346.i36DkRdh019920@arch20m.dellroad.org> (raw)
In-Reply-To: <20040406115205.3060@smtp.mail.ch.easynet.net>

Sascha Brawer wrote:
> >     PhantomReference wr = try1 (q, harness);
> >     System.gc ();
> >+    Thread.yield();
> >+    System.gc ();
> > 
> >     Reference r = null;
> >     try
> 
> Does this really guarantee that the finalizer has run? Couldn't this also
> lead to any other thread, such as some VM-internal thread, without
> running the finalizer? If so, you might want to call Object.notify in the
> finalizer and Object.wait at the above code location.

This patch doesn't guarantee anything, and in general it's impossible
to make this test "correct" because the spec allows finalization and
reference enqueuing to happen after arbitrarily long delays.

For example, a JVM that *never* finalizes is still within the spec
(it would probably throw OutOfMemoryError's more readily though).

This patch simply makes the test "correct" for JC (and possibly
some other VM(s) out there). Since there's no way to *ensure* the
finalizer and reference enqueing thread(s) have run, we just try
to give them every opportunity to do so before declaring that their
work should be done.

-Archie

__________________________________________________________________________
Archie Cobbs      *        CTO, Awarix        *      http://www.awarix.com

  parent reply	other threads:[~2004-04-06 14:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200404060330.i363UY1B018067@arch20m.dellroad.org>
2004-04-06 11:52 ` Sascha Brawer
2004-04-06 12:15   ` Ingo Prötel
2004-04-06 14:08   ` Archie Cobbs [this message]
2004-04-07  5:45     ` Tom Tromey
2004-04-07  6:01       ` Stephen Crawley
2004-04-07 14:53         ` Archie Cobbs
2004-04-15 21:04     ` Mark Wielaard

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=200404061346.i36DkRdh019920@arch20m.dellroad.org \
    --to=archie@dellroad.org \
    --cc=brawer@dandelis.ch \
    --cc=commit-classpath@gnu.org \
    --cc=mauve-discuss@sources.redhat.com \
    /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).