<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "Dispatch",
  "identifier" : "/documentation/Dispatch/dispatch_get_main_queue",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Dispatch"
    ],
    "preciseIdentifier" : "c:@F@dispatch_get_main_queue"
  },
  "title" : "dispatch_get_main_queue"
}
-->

# dispatch_get_main_queue

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

```
static dispatch_queue_main_tdispatch_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()`](/documentation/Dispatch/dispatchMain())
- Calling <doc://com.apple.documentation/documentation/UIKit/UIApplicationMain(_:_:_:_:)-1yub7> (iOS) or <doc://com.apple.documentation/documentation/AppKit/NSApplicationMain(_:_:)> (macOS)
- Using a <doc://com.apple.documentation/documentation/CoreFoundation/CFRunLoop> on the main thread

As with the global concurrent queues, calls to [`suspend()`](/documentation/Dispatch/DispatchObject/suspend()), [`resume()`](/documentation/Dispatch/DispatchObject/resume()), [`dispatch_set_context`](/documentation/Dispatch/dispatch_set_context), and the like have no effect when used with queues returned by this function.

## See Also

  [Concurrency Programming Guide](https://developer.apple.com/library/archive/documentation/General/Conceptual/ConcurrencyProgrammingGuide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40008091)



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)