<!--
{
  "documentType" : "article",
  "framework" : "Dispatch",
  "identifier" : "/documentation/Dispatch/dispatch-objects",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "Dispatch Objects"
}
-->

# Dispatch Objects

The basic behaviors supported by all dispatch types.

## Discussion

There are many types of dispatch objects, including [`dispatch_queue_t`](/documentation/Dispatch/dispatch_queue_t), [`dispatch_group_t`](/documentation/Dispatch/dispatch_group_t), and [`dispatch_source_t`](/documentation/Dispatch/dispatch_source_t). The base dispatch object interfaces allow you to manage memory, pause and resume execution, define object context, log task data, and more.

By default, dispatch objects are declared as Objective-C types when you build them with an Objective-C compiler. This behavior lets you adopt ARC and enable memory leak checks by the static analyzer. It also lets you add your objects to Cocoa collections.

## Topics

### Activating, Suspending, and Resuming the Object

[`func activate()`](/documentation/Dispatch/DispatchObject/activate())

Activates the dispatch object.

[`func suspend()`](/documentation/Dispatch/DispatchObject/suspend())

Suspends the invocation of block objects on a dispatch object.

[`func resume()`](/documentation/Dispatch/DispatchObject/resume())

Resumes the invocation of block objects on a dispatch object.

[`typealias dispatch_object_t`](/documentation/Dispatch/dispatch_object_t)

A dispatch object.

### Changing the Assigned Target Queue

[`func setTarget(queue: dispatch_queue_t?)`](/documentation/Dispatch/DispatchObject/setTarget(queue:))

Specifies the dispatch queue on which to perform work associated with the current object.

### Updating Contextual Data

[`extern void *dispatch_get_context(dispatch_object_t object);`](/documentation/Dispatch/dispatch_get_context)

Returns the application-defined context of an object.

[`extern void dispatch_set_context(dispatch_object_t object, void *context);`](/documentation/Dispatch/dispatch_set_context)

Associates an application-defined context with the object.

### Managing Memory

[`extern void dispatch_retain(dispatch_object_t object);`](/documentation/Dispatch/dispatch_retain)

Increments the reference count (the retain count) of a dispatch object.

[`extern void dispatch_release(dispatch_object_t object);`](/documentation/Dispatch/dispatch_release)

Decrements the reference count (the retain count) of a dispatch object.

[`extern void dispatch_set_finalizer_f(dispatch_object_t object, dispatch_function_t finalizer);`](/documentation/Dispatch/dispatch_set_finalizer_f)

Sets the finalizer function for a dispatch object.

### Introspecting a Dispatch Object

[`extern void dispatch_introspection_hook_queue_create(dispatch_queue_t queue);`](/documentation/Dispatch/dispatch_introspection_hook_queue_create)

[`extern void dispatch_introspection_hook_queue_destroy(dispatch_queue_t queue);`](/documentation/Dispatch/dispatch_introspection_hook_queue_destroy)

[`extern void dispatch_introspection_hook_queue_item_enqueue(dispatch_queue_t queue, dispatch_object_t item);`](/documentation/Dispatch/dispatch_introspection_hook_queue_item_enqueue)

[`extern void dispatch_introspection_hook_queue_item_dequeue(dispatch_queue_t queue, dispatch_object_t item);`](/documentation/Dispatch/dispatch_introspection_hook_queue_item_dequeue)

[`extern void dispatch_introspection_hook_queue_callout_begin(dispatch_queue_t queue, void *context, dispatch_function_t function);`](/documentation/Dispatch/dispatch_introspection_hook_queue_callout_begin)

[`extern void dispatch_introspection_hook_queue_callout_end(dispatch_queue_t queue, void *context, dispatch_function_t function);`](/documentation/Dispatch/dispatch_introspection_hook_queue_callout_end)

[`extern void dispatch_introspection_hook_queue_item_complete(dispatch_object_t item);`](/documentation/Dispatch/dispatch_introspection_hook_queue_item_complete)



---

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)