Atomic updates

bearophile bearophileHUGS at lycos.com
Mon Jan 21 12:35:15 PST 2013


qznc:

> Code: http://dpaste.dzfl.pl/e6615a53
>
> Any comments or improvements?

I have reformatted your code a little, according to the style 
used in all other D entries of RosettaCode:

http://codepad.org/ceDyQ8lE

The usage of a sink for toString() isn't common, but it's OK.

I suggest to add something to make it stop after 20 seconds or so 
(I run all the rosettacode entries every so often to test them, 
so I prefer them to not go on forever. Some entries are required 
to produce infinite loops, but I think this time it's not 
necessary).


> I actually implemented a more scalable version than most of the 
> other languages used, by using a lock per item instead of a 
> single lock for the whole array.

Then I suggest you to add this comment before the entry.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list