2

I am working some threaded library code that needs to support 32 and 64 bit codebases, so there are various interlocked calls throughout the contentious paths specifically to handle non-atomic loads and stores of Int64s.

I am wondering, when executing on a 64-bit platform, are there any special optimizations that are done when operating on Int64s? Specifically, are Interlocked.Read(...) calls transformed into the equivalent ordinary assignment? Are Interlocked.Exchange(...) calls where the result is thrown away also turned into ordinary assignment?

Chuu
  • 4,301
  • 2
  • 28
  • 54
  • 1
    Any Interlocked method can never be optimized to a simple assignment. These are helper methods inside the CLR and written in assembly, the jitter never touches them. – Hans Passant Jul 25 '12 at 00:11

0 Answers0