我又试了一个别的
Private Shared s As Integer = 0
Parallel.For(0, 100, Sub(i)
s = s + ceshi(i)
End Sub)
Public Function ceshi(a)
Dim s As Single
s = a * a
ceshi = s
End Function
按道理来说s应该每次都是一样的,都是328350,但是有的时候就不一样了
我又试了一个别的
Private Shared s As Integer = 0
Parallel.For(0, 100, Sub(i)
s = s + ceshi(i)
End Sub)
Public Function ceshi(a)
Dim s As Single
s = a * a
ceshi = s
End Function
按道理来说s应该每次都是一样的,都是328350,但是有的时候就不一样了