---
title: dispatch_get_main_queue
framework: dispatch
role: symbol
role_heading: Function
path: dispatch/dispatch_get_main_queue
---

# dispatch_get_main_queue

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

## Declaration

```occ
static dispatch_queue_main_tdispatch_get_main_queue();
```

## Return Value

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

## Discussion

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](apple-archive/documentation/General/Conceptual/ConcurrencyProgrammingGuide/Introduction.md)

### Queues and Tasks

- [dispatch_get_global_queue](dispatch/dispatch_get_global_queue.md)
- [Dispatch Queue](dispatch/dispatch-queue.md)
- [Dispatch Work Item](dispatch/dispatch-work-item.md)
- [Dispatch Group](dispatch/dispatch-group.md)
- [Workloop](dispatch/workloop.md)
