[dmd-concurrency] synchronized, shared, and regular methods inside the same class
Kevin Bealer
kevinbealer at gmail.com
Wed Jan 6 23:28:05 PST 2010
On Wed, Jan 6, 2010 at 3:09 PM, Sean Kelly <kelly.sean at apple.com> wrote:
> On Jan 6, 2010, at 11:52 AM, Sean Kelly wrote:
> >
> > In cases 1 and 2, all we really need to worry about is the assignment to
> x. On recent x86 we should be able to use 8 byte CAS to do it in one shot,
> but on other architectures the algorithm seems more complicated. I'd need
> to poke around to see if there's a published algorithm for updating two
> values together, but here's a shot at it that uses a special value assigned
> to the array pointer as a sentinel
>
> I just thought of a better approach. Simply set the '1' bit of the pointer
> to indicate that an update is taking place, since it really will never be
> set under normal circumstances.
> _______________________________________________
> dmd-concurrency mailing list
> dmd-concurrency at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-concurrency
>
But be sure to tell the GC that pointers can now look like (ptr % 4 == 1) as
well as (ptr % 4 == 0). Otherwise a conservative GC might toss your object.
Kevin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/dmd-concurrency/attachments/20100107/6a681a26/attachment.htm>
More information about the dmd-concurrency
mailing list