== Quote from Tomas Lindquist Olsen (tomas.l.ol...@gmail.com)'s article
> Is there a reason for the missing announcement ?
> http://digitalmars.com/d/1.0/changelog.html#new1_045
> http://www.digitalmars.com/d/2.0/changelog.html#new2_030
> and what happened to 1.044 ?
> -Tomas

Probably because it doesn't quite work yet.  I'm waiting for some crufty old 
2.029
code to run, so I thought I'd try out shared a little.  Here are the results:

import std.stdio, std.perf, core.thread;

shared uint foo;

void main() {
    auto t = new Thread({stuff();});
    t.start;
    scope pc = new PerformanceCounter;
    pc.start;
    foreach(i; 0..10_000_000) {
        foo++;
    }
    t.join;
    pc.stop;
    writeln(pc.milliseconds);
    uint bar = foo;
    writeln(bar);  // Prints some pseudorandom, wrong number.
}

void stuff() {
    foreach(i; 0..10_000_000) {
        foo++;
    }
}

Or is the automatic synchronization of shared variables part not supposed to be
implemented yet?

Reply via email to