In the code, as shown below, if Proc1 and Proc2 run simultaneously on different processors, is it possible for ThingVal2 to get a value other than 5 (for example, zero)?
Class SimpleThing
Public X As Integer
Sub New (ByVal value As Integer)
X = value
End sub
End class
Class ConcurrencyTest
Dim Thing1 As New SimpleThing (5)
Dim Thing2 As New SimpleThing (0)
Dim ThingRef As SimpleThing = Thing1
Dim ThingVal1, ThingVal2 As Integer
Sub Proc1 ()
Thing2.X = 5
Threading.Thread.MemoryBarrier ()
ThingRef = Thing2
End sub
Sub Proc2 ()
ThingVal1 = Thing2.X
ThingVal2 = ThingRef.X
End sub
End class
, , IA64, , Proc2 , ThingRef , X Thing2 . .Net, x86 x64? Proc1 SimpleThing, X 5, ThingRef, , , , , , - , Proc2?
(, Interlocked.CompareExchange). x86/x64 ? , vb.net ?
, , , (, - IA64, )?