GCD
All dispatch queues are first-in,first-out data structures.
Types of dispatch queues:
- serial (as private dispatch queues)
- concurrent (as global dispatch queue)
- main dispatch queue
Advantage:
The most advantage is the simplicity of the work-queue programming model.Dispatch queues let you focus on the work you actually want to perfrom without having to worry about the threard creation and management.
Getting the global dispatch queue:
The sysytem provides each application with three concurrent dispatch queues. These queues are global and are differentiated only by their priority level.
1 dispatch_queue_t aQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
Creating serial dispatch queue:
1 dispatch_queue_t queue;
2 queue = dispatch_queue_create("com.example.MyQueue", NULL);
Dispatch queues and other dispatch objects are reference-counted data types.