I see a problem with implementing the non-blocking version in C. Compare-and-swap must operate on an entire struct. But for example gcc only allows integer types. Quote from gcc docs:The definition given in the Intel documentation allows only for the use of the types int, long, long long as well as their unsigned counterparts. GCC will allow any integral scalar or pointer type that is 1, 2, 4 or 8 bytes in length.
C11 has a new header stdatomic.h which only allows atomic for integer types.
How do you perform CAS on a struct in C( without using a mutex of course )?