shared array?

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Sep 11 12:27:47 PDT 2015


On Friday, 11 September 2015 at 17:29:47 UTC, Prudence wrote:
> 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.

You could use __gshared instead of shared. It means put it in 
non-tls storage, just like shared, but the compiler will not 
attempt to help you use it correctly; you're on your own for 
synchronization, etc.

> What I want is to be able to use Array so I don't have to rely 
> on the GC.

But, again, built-in slices do NOT rely on the GC. Only specific 
methods on them do and you can use your own implementation for 
them.



More information about the Digitalmars-d-learn mailing list