Created
December 10, 2012 23:11
-
-
Save nitsanw/4254221 to your computer and use it in GitHub Desktop.
Ping pong experiment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
// 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