shared array?
Kagamin via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Sep 13 04:11:09 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.
Looks like destruction slipped out of your control. That is
solved by making array an instance member of wrapper singleton,
then you will control its lifetime:
> class MySharedArrayWrapper
> {
> private Array!(int) a;
>
> }
>
> and instead I use
>
> static shared MySharedArrayWrapper;
You will have one static instance of wrapper and it will have one
instance of the array.
More information about the Digitalmars-d-learn
mailing list