Created by: rgurzhiy
This pull request replaces @synchronized
with NSRecursiveLock
as in #249 we've discovered that @synchronized
holds unretained allocations.
The replacement is pretty much straightforward. I've just changed
@synchronized (self.lock) {
...
}
with
[self.lock lock];
...
[self.lock unlock];
and removed all returns in between.
There are still 2 places I'm not sure about: BFTask
- (void)waitUntilFinished {
if ([NSThread isMainThread]) {
[self warnOperationOnMainThread];
}
[self.lock lock];
if (self.completed) {
[self.lock unlock];
return;
}
[self.condition lock];
[self.lock unlock];
...
BFCancellationTokenRegistration
- (void)dispose {
[self.lock lock];
if (self.disposed) {
[self.lock unlock];
return;
}
self.disposed = YES;
[self.lock unlock];
...