On Fri, 08 Jun 2012 22:01:41 -0400, mta`chrono <chr...@mta-international.net> 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
     }
}


Yes, but it would not automatically make ++counter atomic.

My proposal is simply to avoid sharing data that shouldn't be shared (i.e. stack data and temporaries), not to make all operations thread-safe.

-Steve

Reply via email to