[dmd-concurrency] synchronized, shared, and regular methods inside the same class

Sean Kelly kelly.sean at apple.com
Wed Jan 6 12:09:35 PST 2010


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.


More information about the dmd-concurrency mailing list