NSNotification 的同步运行

相同线程

- (void)viewDidLoad {
    [super viewDidLoad];
    NSLog(@"viewWillAppear");
    [[NSNotificationCenter defaultCenter] addObserverForName:@"Test_NOTIFY" object:self queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification * _Nonnull note) {
        NSLog(@"In Observer: Thread = %@", [NSThread currentThread]);
        [NSThread sleepForTimeInterval:5];
    }];
    
    [[NSNotificationCenter defaultCenter] postNotificationName:@"Test_NOTIFY" object:self];
    
    NSLog(@"viewDidLoad Finished");
}

不同线程

- (void)viewDidLoad {
    [super viewDidLoad];
    NSLog(@"viewWillAppear");
    [[NSNotificationCenter defaultCenter] addObserverForName:@"Test_NOTIFY" object:self queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification * _Nonnull note) {
        NSLog(@"In Observer: Thread = %@", [NSThread currentThread]);
        [NSThread sleepForTimeInterval:5];
    }];
    
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        NSLog(@"post: Thread = %@", [NSThread currentThread]);
        [[NSNotificationCenter defaultCenter] postNotificationName:@"Test_NOTIFY" object:self];
        NSLog(@"Post thread Finished");
    });
    
    NSLog(@"viewDidLoad finished");
}

异步还是用NSNotificationQueue吧