Skip to content

Instantly share code, notes, and snippets.

@michealbenedict
Created December 7, 2012 00:23
Show Gist options
  • Save michealbenedict/4229665 to your computer and use it in GitHub Desktop.
Save michealbenedict/4229665 to your computer and use it in GitHub Desktop.
static long foo = 0;
public static Lock lock = newLock();
private static void increment() {
for(long l=0;l<1000000000L;l++) {
lock.lock();
try {
foo++;
} finally {
lock.unlock();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment