That's sscli, not the .NET BCL. I think they have different memory models.
My guess is the MemoryBarrier was placed between "int ret = address"
and "return ret" to ensure the two instructions aren't reordered with
respect to each other.
One problem I see with that is that the read from "address" may not see
writes from other threads.
As Vance Morrision describes the .NET 2.0 memory model [1] "reads can only
move earlier in time, but never past a write", and "a write cannot move
past a read from the same thread to the same location"; it seems, at least
in .NET 2.0, there could be no reordering with respect to each other.
[1]
http://msdn.microsoft.com/msdnmag/issues/05/10/MemoryModels/#S5
===================================
This list is hosted by DevelopMentorĀ®
http://www.develop.com
View archives and manage your subscription(s) at
http://discuss.develop.com
opensubscriber is not affiliated with the authors of this message nor responsible for its content.