Type Property

main

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

Declaration

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:

As with the global concurrent queues, calls to suspend(), resume(), dispatch_set_context(_:_:), and the like have no effect when used on the queue in this property.

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.

See Also

Creating a Dispatch Queue

class func global(qos: DispatchQoS.QoSClass) -> DispatchQueue

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

enum DispatchQoS.QoSClass

Quality-of-service classes that specify the priorities for executing tasks.

struct DispatchQueue.Attributes

Attributes that define the behavior of a dispatch queue.

enum DispatchQueue.AutoreleaseFrequency

Constants indicating the frequency with which a dispatch queue autoreleases objects.

class OS_dispatch_queue_main

A system-provided dispatch queue that schedules tasks for serial execution on the app's main thread.

class OS_dispatch_queue_global

A system-provided dispatch queue that schedules tasks for concurrent execution.

class OS_dispatch_queue_serial

A custom dispatch queue that schedules tasks for serial execution on an arbitrary thread.

class OS_dispatch_queue_concurrent

A custom dispatch queue that schedules tasks for concurrent execution.

typealias dispatch_queue_main_t

A dispatch queue that is bound to the app's main thread and executes tasks serially on that thread.

typealias dispatch_queue_global_t

A dispatch queue that executes tasks concurrently using threads from the global thread pool.

typealias dispatch_queue_serial_t

A dispatch queue that executes tasks serially in first-in, first-out (FIFO) order.

typealias dispatch_queue_concurrent_t

A dispatch queue that executes tasks concurrently and in any order, respecting any barriers that may be in place.