Skip to content

Instantly share code, notes, and snippets.

@yohhoy
Last active September 22, 2022 04:44
Show Gist options
  • Save yohhoy/14b88ad316aac1445da7ce515f989812 to your computer and use it in GitHub Desktop.
Save yohhoy/14b88ad316aac1445da7ce515f989812 to your computer and use it in GitHub Desktop.
// https://groups.google.com/g/golang-nuts/c/Gze1TRtdLdc/m/RoD2AxssDgAJ
// http://svr-pes20-cppmem.cl.cam.ac.uk/cppmem/
int main() {
int x = 0;
atomic_int int y = 0;
{{{ { x = 1;
y.store(1);
x = 1;
y.store(1); }
||| { y.load().readsvalue(0);
y.load().readsvalue(1);
r1 = x; }
}}};
return 0; }
// 864 executions; 2 consistent, only 1 race free
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment