Note: groups.io will be down for maintenance on Wednesday, October 5th, starting at 9AM Pacific Time (4PM Wednesday October 5, 2022 UTC), for approximately one hour.
On 02/05/21 10:12, Paolo Bonzini wrote:
On 05/02/21 08:48, Laszlo Ersek wrote:
This is correct, alternatively you could have this:
MemoryFence ();If Address points to a byte in RAM that's manipulated by
Value = *Address
} while (Value == 0xFF) ;
multiple CPUs, then I think:
- volatile is not needed
- the two MemoryFence() calls should be removed
- an AcquireMemoryFence() call should be inserted into the loop, after
the read access. Because, presumably, once the flag assumes the
appropriate value (it has been "released")), we'll proceed to reading
some memory resource that was protected by the flag until then.
// Force re-reading *Address on every iteration
Value = *Address;
} while (Value == 0xFF);
// As you explained above.
Ah, thanks; also good example where a CompilerFence() would be justified.
Join email@example.com to automatically receive all group messages.