-
Notifications
You must be signed in to change notification settings - Fork 289
Open
Description
In initWithCacheDirectory method of EGOCache.m file, the dispatch_set_target_queue's usage is not correct.
- (instancetype)initWithCacheDirectory:(NSString*)cacheDirectory {
if((self = [super init])) {
_cacheInfoQueue = dispatch_queue_create("com.enormego.egocache.info", DISPATCH_QUEUE_SERIAL);
dispatch_queue_t priority = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0);
dispatch_set_target_queue(priority, _cacheInfoQueue);
_frozenCacheInfoQueue = dispatch_queue_create("com.enormego.egocache.info.frozen", DISPATCH_QUEUE_SERIAL);
priority = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0);
dispatch_set_target_queue(priority, _frozenCacheInfoQueue);
_diskQueue = dispatch_queue_create("com.enormego.egocache.disk", DISPATCH_QUEUE_CONCURRENT);
priority = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0);
dispatch_set_target_queue(priority, _diskQueue);In man page of dispatch_set_target_queue, it has below statements:
The result of passing the main queue or a global concurrent queue as the first argument of dispatch_set_target_queue() is undefined.
So the usage of dispatch_set_target_queue is not correct, the correct usage should be as below:
dispatch_set_target_queue(_cacheInfoQueue, priority);
dispatch_set_target_queue(_frozenCacheInfoQueue, priority);
dispatch_set_target_queue(_diskQueue, priority);Metadata
Metadata
Assignees
Labels
No labels