Mani,

Please go back to my original response. As Alan has just re-stated we do not need a latch or a semaphore here because we already do a join on the thread. As I have said the sleep is to allow the GC a chance to run (eg finalizer and/or reference processor thread).

David

On 8/04/2013 8:53 PM, Mani Sarkar wrote:
We initially introduced CountdownLatch and now Semaphore, to replace the
Thread.sleep(10) which took place before - what appears to be a forced GC
(am I right?):

              System.err.println("GC " + i);
              System.gc();
              System.runFinalization();

As the threads join at the ends of the other, then we can do away with the
Semaphore but how would we simulate the 10ms pause before the forced GC -
is that necessary? Can we still use Semaphores to implement pauses?

Cheers,
mani

On Mon, Apr 8, 2013 at 11:07 AM, Alan Bateman <alan.bate...@oracle.com>wrote:

On 08/04/2013 10:39, Mani Sarkar wrote:

Hi David,

Here's the version of
*jdk8_tl/jdk/**test/java/lang/**ref/Basic.java*implemented using a
Semaphore:

  Hi Mani,

Is there a handshake really needed here? From a quick look at the test
then it looks to me that fork (used by createNoise) does a Thread.join so
it waiting until the task is complete before it returns.

-Alan




Reply via email to