Skip to content

Instantly share code, notes, and snippets.

@nitsanw
Created December 10, 2012 23:11
Show Gist options
  • Save nitsanw/4254221 to your computer and use it in GitHub Desktop.
Save nitsanw/4254221 to your computer and use it in GitHub Desktop.
Ping pong experiment
...
// On the ping thread
for (long l = 0; l < iterations; l++) {
pingValue.set(l);
while (pongValue.get() != l)
;
}
...
// On the pong thread
for (long l = 0; l < iterations; l++) {
while (pingValue.get() != l)
;
pongValue.set(l);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment