Skip to content

Instantly share code, notes, and snippets.

@qsLI
Created August 27, 2017 16:10
Show Gist options
  • Save qsLI/80fbca34067da68bdb45de43416e56fb to your computer and use it in GitHub Desktop.
Save qsLI/80fbca34067da68bdb45de43416e56fb to your computer and use it in GitHub Desktop.
acquire lock on object state
while (precondition does not hold) {
release lock
wait until precondition might hold
optional fail if interrupted or timeout expires
require lock
}
perform action
release lock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment