Function

dispatch_retain

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

Declaration

void dispatch_retain(dispatch_object_t object);

Parameters

object

The object to retain. This parameter cannot be NULL.

Discussion

Calls to this function must be balanced with calls to dispatch_release. If multiple subsystems of your application share a dispatch object, each subsystem should call dispatch_retain to register its interest in the object. The object is deallocated only when all subsystems have released their interest in the dispatch source.

Note that your application does not need to retain or release the global (main and concurrent) dispatch queues.

See Also

Managing Memory

dispatch_release

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

dispatch_set_finalizer_f

Sets the finalizer function for a dispatch object.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software