多线程 GCD 异步同步与串行

请教多线程 GCD 关于异步同步与串行相关的问题

```

dispatch_queue_t queue = dispatch_queue_create("com.serial.com", DISPATCH_QUEUE_SERIAL);

    NSLog(@"1-%@",[NSThread currentThread]);

    dispatch_async(queue,^ {

        NSLog(@"2-%@",[NSThread currentThread]);

        dispatch_sync(queue,^{

            NSLog(@"3-%@",[NSThread currentThread]);

        });

        NSLog(@"4-%@",[NSThread currentThread]);

    });

    NSLog(@"5-%@",[NSThread currentThread]); 

```    print 152

执行到         dispatch_sync(queue,^{ 就结束了。

你可能感兴趣的:(多线程 GCD 异步同步与串行)