[dmd-concurrency] shared arrays

Kevin Bealer kevinbealer at gmail.com
Thu Jan 14 13:21:51 PST 2010


I'd suggest setting the high bit of the length instead.  If I have this
scenario:

char[] foo = "abcd".dup;
char[] bar = foo[1..2];
Then bar is an array with an odd address.

Kevin
On Thu, Jan 14, 2010 at 10:16 AM, Sean Kelly <sean at invisibleduck.org> wrote:

> On Jan 14, 2010, at 4:10 AM, Steve Schveighoffer wrote:
>
> > Having implemented the array append patch to fix stomping, and reading
> the dmd-concurrency debate, I realized that what I implemented is no good
> for shared arrays.
> >
> > In fact, I wonder how shared arrays can support any array operations
>
> I sent an email about this a while back.  In short, if we're going to allow
> array ops on shared arrays at all I think they'll have to use atomic ops to
> "lock" the array for the length of the update.  Basically, set the 1 bit of
> the ptr field to indicate the array is locked.  This gets tricky when more
> than one shared array is involved because the lock has to be acquired on
> each, and because different ops may try to lock arrays in different orders,
> if a spinlock acquire times out the code will have to release all the locks
> it's acquired, wait some random interval, and try again.  Pretty complicated
> stuff if the goal is just to support shared array ops.
>  _______________________________________________
> dmd-concurrency mailing list
> dmd-concurrency at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-concurrency
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/dmd-concurrency/attachments/20100114/41a56e2c/attachment.htm>


More information about the dmd-concurrency mailing list