I am new to .net and would like to know whether .net has the java equivalent of AtomicInteger, ConcurrentLinkedQueue, etc?
I did a bit of search and couldnt come up with anything.
The lock free algorithms need some sort of a CAS instruction, which is provided through the undocumented Unsafe class in Java, does .net have anything equivalent?
In .NET there is the Interlocked class, with static methods Interlocked.Increment() and Interlocked.Decrement().
See http://msdn.microsoft.com/en-us/library/system.threading.interlocked.aspx.
You will also find other atomic och synchronization constructs in the System.Threading namespace.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With