Skip to content

Instantly share code, notes, and snippets.

@novln
Created October 5, 2012 13:14
Show Gist options
  • Save novln/3839739 to your computer and use it in GitHub Desktop.
Save novln/3839739 to your computer and use it in GitHub Desktop.
wlock.lock();
rlock.lock();
try {
long cur_time = System.nanoTime();
if (cur_time > (lastUpdate + 1000000000L)) {
setVersion(getVersion() + 1);
setLastUpdate(cur_time);
}
} finally {
rlock.unlock();
wlock.unlock();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment