Merge branch 'master' into 5.x

This commit is contained in:
Bogdan Poplauschi 2018-07-17 11:10:12 +03:00
commit 957de6d70f
1 changed files with 3 additions and 3 deletions

View File

@ -30,7 +30,7 @@ static id<SDImageLoader> _defaultImageLoader;
@property (strong, nonatomic, readwrite, nonnull) id<SDImageLoader> imageLoader; @property (strong, nonatomic, readwrite, nonnull) id<SDImageLoader> imageLoader;
@property (strong, nonatomic, nonnull) NSMutableSet<NSURL *> *failedURLs; @property (strong, nonatomic, nonnull) NSMutableSet<NSURL *> *failedURLs;
@property (strong, nonatomic, nonnull) dispatch_semaphore_t failedURLsLock; // a lock to keep the access to `failedURLs` thread-safe @property (strong, nonatomic, nonnull) dispatch_semaphore_t failedURLsLock; // a lock to keep the access to `failedURLs` thread-safe
@property (strong, nonatomic, nonnull) NSMutableArray<SDWebImageCombinedOperation *> *runningOperations; @property (strong, nonatomic, nonnull) NSMutableSet<SDWebImageCombinedOperation *> *runningOperations;
@property (strong, nonatomic, nonnull) dispatch_semaphore_t runningOperationsLock; // a lock to keep the access to `runningOperations` thread-safe @property (strong, nonatomic, nonnull) dispatch_semaphore_t runningOperationsLock; // a lock to keep the access to `runningOperations` thread-safe
@end @end
@ -86,7 +86,7 @@ static id<SDImageLoader> _defaultImageLoader;
_imageLoader = loader; _imageLoader = loader;
_failedURLs = [NSMutableSet new]; _failedURLs = [NSMutableSet new];
_failedURLsLock = dispatch_semaphore_create(1); _failedURLsLock = dispatch_semaphore_create(1);
_runningOperations = [NSMutableArray new]; _runningOperations = [NSMutableSet new];
_runningOperationsLock = dispatch_semaphore_create(1); _runningOperationsLock = dispatch_semaphore_create(1);
} }
return self; return self;
@ -165,7 +165,7 @@ static id<SDImageLoader> _defaultImageLoader;
- (void)cancelAll { - (void)cancelAll {
LOCK(self.runningOperationsLock); LOCK(self.runningOperationsLock);
NSArray<SDWebImageCombinedOperation *> *copiedOperations = [self.runningOperations copy]; NSSet<SDWebImageCombinedOperation *> *copiedOperations = [self.runningOperations copy];
UNLOCK(self.runningOperationsLock); UNLOCK(self.runningOperationsLock);
[copiedOperations makeObjectsPerformSelector:@selector(cancel)]; // This will call `safelyRemoveOperationFromRunning:` and remove from the array [copiedOperations makeObjectsPerformSelector:@selector(cancel)]; // This will call `safelyRemoveOperationFromRunning:` and remove from the array
} }