7 ms·
Sit in a Compare-and-Swap loop on `ping` and `pong` as uint32s. Go even faster in the shared memory case. Zoom zoom.
by int08h 2y ago
Sit in a Compare-and-Swap loop on `ping` and `pong` as uint32s. Go even faster in the shared memory case. Zoom zoom.
- amluto 2y agoAt least try to be polite to the cache coherence system, please. Do a loop where you check (with a plain relaxed (when available) read) whether the compare and swap should work and, if not, do your platform’s pause operation (REP NOP on x86) and try again. Only do compare-and-swap if the optimistic read thinks it will work.