The .Net System.Threading.Interlocked class is primarily intended to offer the features of the ASM prefix LOCK.
However, I am scratching my head wondering why Microsoft limited the number of supported commands. I thought it was a "C#" issue, but a quick look on MSDN corrected that idea. It's a .Net limitation.
For example, there is no Interlocked.Or, yet in ASM one can say loosely LOCK OR eax,ebx. So why not Interlocked.Or(ref x, 10).
This makes no sense to me. Why no equivalent of LOCK OR but they do have LOCK ADD. The former is incredibly useful.
So I checked GCC and sure enough, it’s all there. Every single compatible LOCK command: GCC atomic commands
Can anyone shed some light on why MS would have omitted the majority of the x86 LOCK enabled commands?