Int128 and Interlocked operations #71635
-
@tannergooding is it technically possible to implement atomic operations for 128bit int structs with current hardware? Im mostly interested in |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Not really feasible, IMO. You can certainly implement some form of "interlocked" data structures but due to the nature of the implementation, they would all (except sometimes The most feasible thing is really to just expose |
Beta Was this translation helpful? Give feedback.
Not really feasible, IMO. You can certainly implement some form of "interlocked" data structures but due to the nature of the implementation, they would all (except sometimes
CompareExchange
) be implemented as expensive loops. Additionally, on 32-bit such operations get even worse and you can get into really odd behavior.The most feasible thing is really to just expose
Interlocked.CompareExchange
that operates over2x nint
or2x nuint
. That can be atomic on both 32-bit and 64-bit and is more practically useful IMO.