3 ms·
I haven't looked at the C# async implementation, but I'd bet it uses CAS operations. Yup, the C# library is called Interlocked and it provides a variety of ato
by Locke1689 12y ago
I haven't looked at the C# async implementation, but I'd bet it uses CAS operations.
Yup, the C# library is called Interlocked and it provides a variety of atomic operations. C# also has ref, which allows variables to be passed by reference, which greatly increases the power of the library.
I find Interlocked absolutely essential for getting maximum performance -- like in implementing lock-free data structures.