Created
October 18, 2017 12:09
-
-
Save descorp/732c605332969d3f297987f7efa2fe44 to your computer and use it in GitHub Desktop.
Swift lock
This file contains hidden or 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
| private let lock = NSRecursiveLock() | |
| func synchronize(closure: ()->()){ | |
| lock.lock() | |
| defer { | |
| closure() | |
| lock.unlock() | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment