Quantcast
Viewing latest article 3
Browse Latest Browse All 6

Thread Lock Question

 Peter Ritchie wrote:
LOCK is not a value type. Or, do you mean the synchronized access to _Foo;


Value type in that _Foo is a value type which is being returned in the user's code.

 Peter Ritchie wrote:

Reference assignments and built-in type assignments are guarenteed in the C# spec to be atomic; there's no need to synchronize them (you're simply adding overhead that isn't being used).



That is something that I overlooked in my response. The lock on such a type is superfluous due to its atomicity.

Thanks Peter! From here on out I will be aware to present that fact in any future posts I do on the subject.

Viewing latest article 3
Browse Latest Browse All 6

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>