internal SynchedLoop(long iters, SynchedInteger obj, CyclicBarrier b)
 {
     this.iters   = iters;
     this.obj     = obj;
     this.barrier = b;
     obj.set_Renamed(CASLoops.rng.next());
 }
    internal static long runSynched(int n, long iters)
    {
        LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer();
        CyclicBarrier            b     = new CyclicBarrier(n + 1, timer);
        SynchedInteger           a     = new SynchedInteger();

        for (int j = 0; j < n; ++j)
        {
            new SupportClass.ThreadClass(new System.Threading.ThreadStart(new SynchedLoop(iters, a, b).Run)).Start();
        }
        b.Await();
        b.Await();
        if (sum.Value == 0)
        {
            System.Console.Out.Write(" ");
        }
        return(timer.Time);
    }
Пример #3
0
 internal SynchedLoop(long iters, SynchedInteger obj, CyclicBarrier b)
 {
     this.iters = iters;
     this.obj = obj;
     this.barrier = b;
     obj.set_Renamed(CASLoops.rng.next());
 }
Пример #4
0
 internal static long runSynched(int n, long iters)
 {
     LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer();
     CyclicBarrier b = new CyclicBarrier(n + 1, timer);
     SynchedInteger a = new SynchedInteger();
     for (int j = 0; j < n; ++j)
         new SupportClass.ThreadClass(new System.Threading.ThreadStart(new SynchedLoop(iters, a, b).Run)).Start();
     b.Await();
     b.Await();
     if (sum.Value == 0)
         System.Console.Out.Write(" ");
     return timer.Time;
 }