On Friday, 11 September 2015 at 16:04:22 UTC, Kagamin wrote:
On Friday, 11 September 2015 at 14:54:00 UTC, Prudence wrote:
But in this case it is static, so why does it matter? Do you have any ideas how to wrap it or fix this?

It matters exactly because it is static. A code written for single-threaded environment may not work correctly in shared context. It simply wasn't written for it. The way to fix it is to write code for shared context.

I don't care about "maybe" working. Since the array is hidden inside a class I can control who and how it is used and deal with the race conditions.

What I want is to be able to use Array so I don't have to rely on the GC. but since it complains about the ~this destruction, how can I fix that? If I wrap Array, and use a non-shared array inside it, I'll still have the same problem because it will be thread local to the object? or is shared applied to all sub types of a class?

e.g.,

class MySharedArrayWrapper
{
    static Array!(int) a;

}

and instead I use

static shared MySharedArrayWrapper;

But a isn't marked shared, so will it be TLS, which put's me back at square one. Or it it marked shared, which then still complains?

Again, I'm asking how, not why.

Reply via email to