Skip to content

Instantly share code, notes, and snippets.

@efremidze
Created September 15, 2017 01:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save efremidze/763630b1a36d1e7fb266fdddd5e96faa to your computer and use it in GitHub Desktop.
Save efremidze/763630b1a36d1e7fb266fdddd5e96faa to your computer and use it in GitHub Desktop.
extension NSLock {
func withCriticalScope<T>(block: (Void) -> T) -> T {
lock()
let value = block()
unlock()
return value
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment