Function

dispatch_get_main_queue

Returns the serial dispatch queue associated with the application’s main thread.

Declaration

dispatch_queue_main_t dispatch_get_main_queue(void);

Return Value

Returns the main queue. This queue is created automatically on behalf of the main thread before main is called.

Discussion

The system automatically creates the main queue and associates it with your application’s main thread. Your app uses one (and only one) of the following three approaches to invoke blocks submitted to the main queue:

As with the global concurrent queues, calls to dispatch_suspend, dispatch_resume, dispatch_set_context, and the like have no effect when used with queues returned by this function.

See Also

Queues and Tasks

dispatch_get_global_queue

Returns a system-defined global concurrent queue with the specified quality-of-service class.

Dispatch Queue

An object that manages the execution of tasks serially or concurrently on your app's main thread or on a background thread.

Dispatch Work Item

The work you want to perform, encapsulated in a way that lets you attach a completion handle or execution dependencies.

Dispatch Group

A group of tasks that you monitor as a single unit.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software