I've created a serial queue like this:
dispatch_queue_t _serialQueue = dispatch_queue_create("com.example.name", DISPATCH_QUEUE_SERIAL);
What's the difference between dispatch_async
called like this
dispatch_async(_serialQueue, ^{ /* TASK 1 */ });
dispatch_async(_serialQueue, ^{ /* TASK 2 */ });
And dispatch_sync
called like this on this serial queue?
dispatch_sync(_serialQueue, ^{ /* TASK 1 */ });
dispatch_sync(_serialQueue, ^{ /* TASK 2 */ });
My understanding is that, regardless of which dispatch method is used, TASK 1
will be executed and completed before TASK 2
, correct?