diff --git a/QSImageProcess.podspec b/QSImageProcess.podspec index 38f102c..53cfe7b 100644 --- a/QSImageProcess.podspec +++ b/QSImageProcess.podspec @@ -9,6 +9,6 @@ s.platform = :ios, "7.0" s.source = {:git => "https://github.com/buaa0300/QSImageProcess.git", :tag => s.version} s.requires_arc = true s.source_files = "QSImageProcess/*" -s.dependency "QSDispatchQueue", "~>1.0.0" +s.dependency "QSDispatchQueue" s.dependency "SDWebImage", "~>4.1.0" end diff --git a/QSImageProcess/QSDispatchQueue/QSDispatchQueue.m b/QSImageProcess/QSDispatchQueue/QSDispatchQueue.m index e0dbc0c..593b9a6 100644 --- a/QSImageProcess/QSDispatchQueue/QSDispatchQueue.m +++ b/QSImageProcess/QSDispatchQueue/QSDispatchQueue.m @@ -98,7 +98,7 @@ - (instancetype)initWithQueue:(dispatch_queue_t)queue self = [super init]; if (self) { if (!queue) { - queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); + _queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); }else{ _queue = queue; } diff --git a/QSImageProcessDemo/Podfile b/QSImageProcessDemo/Podfile index 6c7cced..a12d6df 100644 --- a/QSImageProcessDemo/Podfile +++ b/QSImageProcessDemo/Podfile @@ -2,7 +2,7 @@ platform :ios, '8.0' target 'QSImageProcessDemo' do - pod 'QSDispatchQueue', '~>1.0.0' + pod 'QSDispatchQueue' pod 'SDWebImage', '~>4.1.0' #内存泄漏检测 pod 'MLeaksFinder' diff --git a/QSImageProcessDemo/Podfile.lock b/QSImageProcessDemo/Podfile.lock index 98cefe7..f23ffe5 100644 --- a/QSImageProcessDemo/Podfile.lock +++ b/QSImageProcessDemo/Podfile.lock @@ -2,22 +2,22 @@ PODS: - FBRetainCycleDetector (0.1.3) - MLeaksFinder (0.2.1): - FBRetainCycleDetector - - QSDispatchQueue (1.0.0) + - QSDispatchQueue (1.0.1) - SDWebImage (4.1.0): - SDWebImage/Core (= 4.1.0) - SDWebImage/Core (4.1.0) DEPENDENCIES: - MLeaksFinder - - QSDispatchQueue (~> 1.0.0) + - QSDispatchQueue - SDWebImage (~> 4.1.0) SPEC CHECKSUMS: FBRetainCycleDetector: f0c7b290bf48ae77f6ae060843ce34ae341781eb MLeaksFinder: 0850e2f2abc7227adc4d4e2d1992b431264eb4d5 - QSDispatchQueue: d54ff4c79e84b1da9c27ffeee4bbd906aae7bb48 + QSDispatchQueue: 3981828538f605d115001ab033e60465a359951a SDWebImage: 0e435c14e402a6730315a0fb79f95e68654d55a4 -PODFILE CHECKSUM: facde65b068e8bbea3079b036972b36215d3dfde +PODFILE CHECKSUM: c4eefc62dc82515961a824ba6933e663c9a2f48d COCOAPODS: 1.2.1 diff --git a/QSImageProcessDemo/Pods/Manifest.lock b/QSImageProcessDemo/Pods/Manifest.lock index 98cefe7..f23ffe5 100644 --- a/QSImageProcessDemo/Pods/Manifest.lock +++ b/QSImageProcessDemo/Pods/Manifest.lock @@ -2,22 +2,22 @@ PODS: - FBRetainCycleDetector (0.1.3) - MLeaksFinder (0.2.1): - FBRetainCycleDetector - - QSDispatchQueue (1.0.0) + - QSDispatchQueue (1.0.1) - SDWebImage (4.1.0): - SDWebImage/Core (= 4.1.0) - SDWebImage/Core (4.1.0) DEPENDENCIES: - MLeaksFinder - - QSDispatchQueue (~> 1.0.0) + - QSDispatchQueue - SDWebImage (~> 4.1.0) SPEC CHECKSUMS: FBRetainCycleDetector: f0c7b290bf48ae77f6ae060843ce34ae341781eb MLeaksFinder: 0850e2f2abc7227adc4d4e2d1992b431264eb4d5 - QSDispatchQueue: d54ff4c79e84b1da9c27ffeee4bbd906aae7bb48 + QSDispatchQueue: 3981828538f605d115001ab033e60465a359951a SDWebImage: 0e435c14e402a6730315a0fb79f95e68654d55a4 -PODFILE CHECKSUM: facde65b068e8bbea3079b036972b36215d3dfde +PODFILE CHECKSUM: c4eefc62dc82515961a824ba6933e663c9a2f48d COCOAPODS: 1.2.1 diff --git a/QSImageProcessDemo/Pods/QSDispatchQueue/QSDispatchQueue/QSDispatchQueue.m b/QSImageProcessDemo/Pods/QSDispatchQueue/QSDispatchQueue/QSDispatchQueue.m index e0dbc0c..593b9a6 100644 --- a/QSImageProcessDemo/Pods/QSDispatchQueue/QSDispatchQueue/QSDispatchQueue.m +++ b/QSImageProcessDemo/Pods/QSDispatchQueue/QSDispatchQueue/QSDispatchQueue.m @@ -98,7 +98,7 @@ - (instancetype)initWithQueue:(dispatch_queue_t)queue self = [super init]; if (self) { if (!queue) { - queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); + _queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); }else{ _queue = queue; } diff --git a/QSImageProcessDemo/Pods/QSDispatchQueue/README.md b/QSImageProcessDemo/Pods/QSDispatchQueue/README.md index d353650..6b40a80 100644 --- a/QSImageProcessDemo/Pods/QSDispatchQueue/README.md +++ b/QSImageProcessDemo/Pods/QSDispatchQueue/README.md @@ -1,2 +1,44 @@ # QSDispatchQueue -QSDispatchQueue + + +**A Way to control maxConcurrentCount of GCD concurrent queue by dispatch_semaphore**(利用GCD的信号量机制实现控制GCD并发队列最大并发数的方案) + +

Installation

+ + pod 'QSDispatchQueue' + + OR put QSDispatchQueue.h and QSDispatchQueue.m into your project directly. + + Then + + #import "QSDispatchQueue.h" + +

Usage-Demo1

+ + dispatch_queue_t workConcurrentQueue = dispatch_queue_create("com.jzp.async.queue", DISPATCH_QUEUE_CONCURRENT); + QSDispatchQueue *queue = [[QSDispatchQueue alloc]initWithQueue:workConcurrentQueue concurrentCount:3]; + for (NSInteger i = 0; i < 10; i++) { + [queue async:^{ + NSLog(@"thread-info:%@开始执行任务%d",[NSThread currentThread],(int)i); + sleep(1); + NSLog(@"thread-info:%@结束执行任务%d",[NSThread currentThread],(int)i); + }]; + } + +

Usage-Demo2

+ + dispatch_queue_t workConcurrentQueue = dispatch_queue_create("com.jzp.sync.queue", DISPATCH_QUEUE_CONCURRENT); + QSDispatchQueue *queue = [[QSDispatchQueue alloc]initWithQueue:workConcurrentQueue concurrentCount:1]; + for (NSInteger i = 0; i < 10; i++) { + [queue sync:^{ + NSLog(@"thread-info:%@开始执行任务%d",[NSThread currentThread],(int)i); + sleep(1); + NSLog(@"thread-info:%@结束执行任务%d",[NSThread currentThread],(int)i); + }]; + } + + +

Relation

+ + http://www.jianshu.com/p/5d51a367ed62 +