Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Grabs a lock and ensures mutual exclusion while calling `closure`
- * Example:
- * synced(self) {
- * // Code
- * }
- */
- func synced(lock: AnyObject, closure: () -> ()) {
- objc_sync_enter(lock)
- closure()
- objc_sync_exit(lock)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement