[dmd-concurrency] shared arrays
Andrei Alexandrescu
andrei at erdani.com
Thu Jan 14 19:01:47 PST 2010
Michel Fortin wrote:
> Le 2010-01-14 à 18:07, Andrei Alexandrescu a écrit :
>> Unfortunately, this(this) is called after the bits have been
>> copied, so if there was any tearing, it already happened. I don't
>> know how we can solve this.
>
> Where is the copy-constructor when we need one? :-)
I realized that fortunately that's not a problem: during memcpy, the
target is not yet shared. Whew. So it all holds water.
this(this) shared { ... }
should work.
> Now, the really tricky question is should this one be copyable when
> shared:
>
> struct D { immutable string a; long b; }
>
> Since 'a' is immutable, you don't need to copy it atomically, only
> 'b' requires an atomic copy. So copying the struct "atomically" is
> possible by copying 'a' normally and 'b' atomically. Now, is that
> going to be supported?
But long isn't atomically copyable. Did you mean int?
Andrei
More information about the dmd-concurrency
mailing list