Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
public final class SpinLock {
private var lock: OSSpinLock = OS_SPINLOCK_INIT
public func locked<A>(@noescape f: () throws -> A) rethrows -> A {
OSSpinLockLock(&lock)
defer { OSSpinLockUnlock(&lock) }
return try f()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.