On 06/17/2014 08:51 AM, George Sapkin wrote:> Does making an array copy
with shared cast away make any sense?
>
> auto n = 10;
> auto sharedData = new shared SomeClass[n];
> foreach (i; 0..n) sharedData[i] = new shared SomeClass(i);
>
> auto nonSharedData = cast(SomeClass[]) sharedData[0..$];
> auto sorted = sort!((a, b) => a.value < b.value)(nonSharedData);
>
> This seems to work but what are the implications?
Shared data can be accessed by more than one thread. Unless it is
locked, other threads may see the array in an inconsistent state.
Ali