On Friday, 1 February 2013 at 02:27:30 UTC, TommiT wrote:
And here's another example of why it is as big of a problem as I make it sound to be:

import std.concurrency;

struct Array
{
    int _len;

    length struct // Using Zach's syntax
    {
        @property get() { return _len; }
        alias this = get;
        void opAssign(int rhs) { _len = rhs; }
    }
}

void func(T)(T t)
{
    auto v = t;
    v = 10;
}

void main()
{
    Array arr;
    spawn(&func!int, arr.length);
    arr.length = 20; // And here we have a data-race.
                     // Good luck trying to find these
                     // kinds of bugs.
}

I'm sorry, I know very little about race conditions. If you might explain just a little bit about what is happening here, I'd be in a better position to understand what you're saying. I really can't say anything other than please describe what this does and why it's a problem at this time.

Reply via email to