O'Reilly logo

Advanced Mac OS X Programming: The Big Nerd Ranch Guide by Mark Dalrymple

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Dispatch API

Queues

Before you can schedule work on a queue, you need to get ahold of a queue to do the work on. You can get the main queue with

dispatch_queue_t dispatch_get_main_queue (void);

You can schedule activity on the main thread by using this queue. This is a serial queue, so work will issue and complete in FIFO order.

dispatch_queue_t dispatch_get_global_queue (long priority,
                                            unsigned long flags);

This gives you one of the global concurrent queues, whose priority is one of the DISPATCH_QUEUE_PRIORITY_LOW, DEFAULT, or HIGH priority constants. Pass 0UL for flags; it is ignored now and is an expansion point for the future. The priority refers to which queue gets its blocks scheduled. The default queue’s blocks only get run on threads ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required