swift mutual exclusion
concurrency – What is the Swift equivalent to Objective-C’s "@synchronized"? – Stack Overflow
Grabs a lock and ensures mutual exclusion in swift · GitHub
Snip2Code – Grabs a lock and ensures mutual exclusion in swift
func synced(lock: AnyObject, closure: () -> ()) { objc_sync_enter(lock) closure() objc_sync_exit(lock) } |
synced(self) { println("This is a synchronized closure") } |