[dmd-concurrency] A synchronized storage class?

Sean Kelly sean at invisibleduck.org
Thu Jan 7 09:33:43 PST 2010


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.


More information about the dmd-concurrency mailing list