私有方法
1.有个文件:RACScheduler+Private.h,让我想起很多第三方库会出现xxx+Private.h的头文件,不是很明白。其实它是把xxx.m里的某些方法的定义写在了xxx+Private.h里了,提示你它是私有的。
RACTargetQueueScheduler
@implementation RACTargetQueueScheduler
#pragma mark Lifecycle
- (id)initWithName:(NSString *)name targetQueue:(dispatch_queue_t)targetQueue {
NSCParameterAssert(targetQueue != NULL);
if (name == nil) {
name = [NSString stringWithFormat:@"com.ReactiveCocoa.RACTargetQueueScheduler(%s)", dispatch_queue_get_label(targetQueue)];
}
dispatch_queue_t queue = dispatch_queue_create(name.UTF8String, DISPATCH_QUEUE_SERIAL);
if (queue == NULL) return nil;
dispatch_set_target_queue(queue, targetQueue);
return [super initWithName:name queue:queue];
}
dispatch_set_target_queue最为特殊,它把其它队列无论是串并行队列都压进了一个串行队列,保证scheuler的稳定性。还可以把自己的优先级改变成目标队列的优先级。