dispatch_get_main_queue
Returns the serial dispatch queue associated with the application’s main thread.
Declaration
static dispatch_queue_main_t dispatch_get_main_queue();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:
Calling dispatchMain()
Calling UIApplicationMain(_:_:_:_:) (iOS) or NSApplicationMain(_:_:) (macOS)
Using a CFRunLoop on the main thread
As with the global concurrent queues, calls to suspend(), resume(), dispatch_set_context, and the like have no effect when used with queues returned by this function.
See Also
Related Documentation
- Concurrency Programming Guide