Dispatch Data

An object that manages a memory-based data buffer and exposes it as a contiguous block of memory.

Overview

The memory buffer managed by this object may be a single contiguous block of memory, or it may consist of multiple discontiguous blocks. For the discontiguous case, the dispatch data object makes it appear as if the memory is contiguous.

Topics

Creating a Dispatch Data Object

dispatch_data_create

Creates a new dispatch data object with the specified memory buffer.

dispatch_data_create_map

Returns a new dispatch data object containing a contiguous representation of the specified object’s memory.

dispatch_data_create_concat

Returns a new dispatch data object consisting of the concatenated data from two other data objects.

dispatch_data_create_subrange

Returns a new dispatch data object whose contents consist of a portion of another object’s memory region.

dispatch_data_copy_region

Returns a data object containing a portion of the data in another data object.

dispatch_data_empty

A dispatch data object representing a zero-length memory region.

dispatch_data_t

An immutable object representing a contiguous or sparse region of memory.

DISPATCH_DATA_DESTRUCTOR_DEFAULT

The default data destructor for dispatch objects.

DISPATCH_DATA_DESTRUCTOR_FREE

The destructor for dispatch data objects whose memory buffer was created using the malloc family of allocation routines.

Getting the Number of Elements

dispatch_data_get_size

Returns the logical size of the memory managed by a dispatch data object

Applying Changes to the Data

dispatch_data_apply

Traverses the memory of a dispatch data object and executes custom code on each region.

dispatch_data_applier_t

A block to invoke for every contiguous memory region in a data object.

See Also

System Event Monitoring

Dispatch Source

An object that coordinates the processing of specific low-level system events, such as file-system events, timers, and UNIX signals.

Dispatch I/O

An object that manages operations on a file descriptor using either stream-based or random-access semantics.