<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "Dispatch",
  "identifier" : "/documentation/Dispatch/DispatchQueue/main",
  "metadataVersion" : "0.1.0",
  "role" : "Type Property",
  "symbol" : {
    "kind" : "Type Property",
    "modules" : [
      "Dispatch"
    ],
    "preciseIdentifier" : "s:So17OS_dispatch_queueC8DispatchE4mainABvpZ"
  },
  "title" : "main"
}
-->

# main

The dispatch queue associated with the main thread of the current process.

```
class var main: DispatchQueue { get }
```

## 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 execute blocks submitted to the main queue:

- Calling [`dispatchMain()`](/documentation/Dispatch/dispatchMain())
- Starting your app with a call to <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 on the queue in this property.

> Important:
> If the main thread is unresponsive for too long, it can lead to a `0x8badf00d` exception with the main thread at `mach_msg_trap`. On iOS, this exception may be raised if the watchdog mechanism detects that your app failed to respond to certain user interface events in time. The iOS watchdog exists in order to keep the user interface responsive.

If your app has a long running task, such as making network call, run it on a global system queue, or on another background dispatch queue. Alternatively, use asynchronous versions of the call, if available.

---

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)