Does Volatile.Read/Volatile.Write for a "double" atom?

MSDN declares that

long, ulong, double and decimal, as well as custom types are not guaranteed as atomic 5.5. Atomicity of variable references

Will it Volatile.Write Method (Double%, Double)work like an atomic operation? If so, how is this guaranteed?

Is it possible to do Volatile.Write(ref mydouble, value);in one thread and Volatile.Read(ref mydouble)in another where type mydoublehas double?

That was a general question. Another question: what should I do in this particular situation:

  • 2 xeon x64 server processors
  • Windows + MS.NET 4.5
  • read / write double from different streams
  • SMALLEST latency (requires the least because I write HFT software)
+5
source share
2 answers

, , , Interlocked, Interlocked.Exchange, Interlocked.Read

: , Volatile , SMP ( > 1 ). .

+7

, . , ?

+1

All Articles