BlockA is @synchronized(obj) { code }actually equivalent
NSRecursiveLock *lock = objc_fetchLockForObject(obj);
[lock lock];
@try {
code
}
@finally {
[lock unlock];
}
although any particular aspect of this is just implementation details. But yes, the block is @synchronizedguaranteed to release the lock no matter how the control exits the block.
source
share