On 06/09/2012 04:01 AM, mta`chrono wrote:
Would this be legal?

class A
{
      private static shared int counter; // shared across all instances

      this()
      {
           auto i = ++counter;
           pragma(msg, typeof(i)); // prints int
      }
}


Would it also be legal if the variable wasn't static?

int opApply(int delegate(ref Pixels) dg)
{
    shared(int) progress;

foreach ( row; taskPool.parallel(iota(extent.y, extent.y + extent.height)) )
    {
        int result = dg(Pixels(image, extent.x, row, extent.width, 1));

        if ( result )
             return result;

        if ( image.monitor !is null )
        {
            atomicOp!"+="(progress, 1);
image.monitor()("ImageView/" ~ image.filename, progress, extent.height);
        }
    }
    return 0;
}

--
Mike Wey

Reply via email to