May somebody tell me if it is ok to return from inside a @synchronized block?
For example:
- (id)methodThatReturnsSomething:(BOOL)bDoIt
{
@synchronized(self) {
if(!bDoIt) return nil;
...
}
}
or should I unlock the block first (using NSLock instead)?
@synchronizedwill automatically take down its exception-handling context when you return, and relinquish the lock. So the code you’ve written is fine.