DispatchQueue
Extends:
DispatchQueue manages the execution of work items. Each work item submitted to a queue is processed on a pool of threads managed by the system.
Static Member Summary
Static Public Members | ||
public static get |
|
Static Method Summary
Static Public Methods | ||
public static |
concurrentPerformExecute(iterations: number, work: function(arg1: number): void): void |
|
public static |
global(priority: DispatchQueue.GlobalQueuePriority): DispatchQueue this method was deprecated.
|
Constructor Summary
Public Constructor | ||
public |
constructor(label: string, qos: DispatchQoS, attributes: DispatchQueue.Attributes, autoreleaseFrequency: DispatchQueue.AutoreleaseFrequency, target: DispatchQueue) |
Method Summary
Public Methods | ||
public |
asyncAfter(deadline: DispatchTime, execute: DispatchWorkItem): void |
|
public |
asyncAfterExecute(deadline: DispatchTime, qos: DispatchQoS, flags: DispatchWorkItemFlags, work: function(): void): void |
|
public |
asyncExecute(workItem: DispatchWorkItem): void |
|
public |
getSpecific(key: DispatchSpecificKey<T>): T |
|
public |
init__label(label: UnsafePointer<Int8>, attr: __OS_dispatch_queue_attr): void Blocks submitted to a serial queue are executed one at a time in FIFO order. |
|
public |
init__labelQueue(label: UnsafePointer<Int8>, attr: __OS_dispatch_queue_attr, target: DispatchQueue): void |
|
public |
setSpecific(key: DispatchSpecificKey<T>, value: T): void |
|
public |
sync(flags: DispatchWorkItemFlags): void |
|
public |
syncExecute(workItem: DispatchWorkItem): void |
Inherited Summary
From class DispatchObject | ||
public |
activate(): void Once a dispatch object has been activated, it cannot change its target queue. |
|
public |
resume(): void Calling this function decrements the suspension count of a suspended dispatch queue or dispatch event source object. |
|
public |
setTarget(queue: DispatchQueue): void An object's target queue is responsible for processing the object. The target queue determines the queue on which the object's finalizer is invoked. |
|
public |
suspend(): void By suspending a dispatch object, your application can temporarily prevent the execution of any blocks associated with that object. |
Static Public Members
public static get main: DispatchQueue source
Static Public Methods
public static concurrentPerformExecute(iterations: number, work: function(arg1: number): void): void source
Return:
void |
public static global(priority: DispatchQueue.GlobalQueuePriority): DispatchQueue source
Params:
Name | Type | Attribute | Description |
priority | DispatchQueue.GlobalQueuePriority |
Public Constructors
public constructor(label: string, qos: DispatchQoS, attributes: DispatchQueue.Attributes, autoreleaseFrequency: DispatchQueue.AutoreleaseFrequency, target: DispatchQueue) source
constructor
Override:
DispatchObject#constructorParams:
Name | Type | Attribute | Description |
label | string | ||
qos | DispatchQoS | ||
attributes | DispatchQueue.Attributes | ||
autoreleaseFrequency | DispatchQueue.AutoreleaseFrequency | ||
target | DispatchQueue |
|
Public Methods
public asyncAfter(deadline: DispatchTime, execute: DispatchWorkItem): void source
Params:
Name | Type | Attribute | Description |
deadline | DispatchTime | ||
execute | DispatchWorkItem |
Return:
void |
public asyncAfterExecute(deadline: DispatchTime, qos: DispatchQoS, flags: DispatchWorkItemFlags, work: function(): void): void source
Params:
Name | Type | Attribute | Description |
deadline | DispatchTime | ||
qos | DispatchQoS | ||
flags | DispatchWorkItemFlags | ||
work | function(): void |
Return:
void |
public asyncExecute(workItem: DispatchWorkItem): void source
Params:
Name | Type | Attribute | Description |
workItem | DispatchWorkItem |
Return:
void |
public getSpecific(key: DispatchSpecificKey<T>): T source
Params:
Name | Type | Attribute | Description |
key | DispatchSpecificKey<T> |
Return:
T (nullable: true) |
public init__label(label: UnsafePointer<Int8>, attr: __OS_dispatch_queue_attr): void source
Blocks submitted to a serial queue are executed one at a time in FIFO order. Note, however, that blocks submitted to independent queues may be executed concurrently with respect to each other. Blocks submitted to a concurrent queue are dequeued in FIFO order but may run concurrently if resources are available to do so.If your app isn’t using ARC, you should call dispatch_release on a dispatch queue when it’s no longer needed. Any pending blocks submitted to a queue hold a reference to that queue, so the queue is not deallocated until all pending blocks have completed.
Params:
Name | Type | Attribute | Description |
label | UnsafePointer<Int8> |
|
A string label to attach to the queue to uniquely identify it in debugging tools such as Instruments, sample, stackshots, and crash reports. Because applications, libraries, and frameworks can all create their own dispatch queues, a reverse-DNS naming style (com.example.myqueue) is recommended. This parameter is optional and can be NULL. |
attr | __OS_dispatch_queue_attr |
|
In macOS 10.7 and later or iOS 4.3 and later, specify DISPATCH_QUEUE_SERIAL (or NULL) to create a serial queue or specify DISPATCH_QUEUE_CONCURRENT to create a concurrent queue. In earlier versions, you must specify NULL for this parameter. |
Return:
void |
public init__labelQueue(label: UnsafePointer<Int8>, attr: __OS_dispatch_queue_attr, target: DispatchQueue): void source
Params:
Name | Type | Attribute | Description |
label | UnsafePointer<Int8> |
|
|
attr | __OS_dispatch_queue_attr |
|
|
target | DispatchQueue |
|
Return:
void |
public setSpecific(key: DispatchSpecificKey<T>, value: T): void source
Params:
Name | Type | Attribute | Description |
key | DispatchSpecificKey<T> | ||
value | T |
Return:
void |
public sync(flags: DispatchWorkItemFlags): void source
Params:
Name | Type | Attribute | Description |
flags | DispatchWorkItemFlags |
Return:
void |
Throw:
public syncExecute(workItem: DispatchWorkItem): void source
Params:
Name | Type | Attribute | Description |
workItem | DispatchWorkItem |
Return:
void |