[dmd-concurrency] A synchronized storage class?

Sean Kelly sean at invisibleduck.org
Thu Jan 7 10:16:28 PST 2010


It's probably needless complexity, but the only thingthat would need  
to change here is "head shared.". The tail would remain shared for  
shared and non-shared instances.  Then what you suggest would work for  
eerything.

Sent from my iPhone

On Jan 7, 2010, at 9:33 AM, Sean Kelly <sean at invisibleduck.org> wrote:

> On Jan 7, 2010, at 9:27 AM, Michel Fortin wrote:
>>
>> It's good that the lock-free algorithm is forced to use atomic ops,  
>> but it's wasteful when the object itself is not shared. So the  
>> above could be changed like this:
>>
>>    a1.x  is not shared  synchronization has no effect (a1 is not  
>> shared)
>>    a1.y  is not shared  no need for atomic ops, synchronization has  
>> no effect
>>    a2.x  is shared  synchronization is needed for access
>>    a2.y  is shared  only accessible through atomic ops
>
> If this is the case then references would have to be exempt though.   
> A local field can have a reference to a shared class.  I'm not  
> convinced that you'd often have lock-free algorithms that would also  
> be used in a TLS scenario though.
> _______________________________________________
> dmd-concurrency mailing list
> dmd-concurrency at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-concurrency


More information about the dmd-concurrency mailing list