This is the mail archive of the mailing list for the Mauve project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Mauve patch

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 Cobbs      *        CTO, Awarix        *

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]