Dispatch Source

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

Topics

Creating a Dispatch Source

dispatch_source_create

Creates a new dispatch source to monitor low-level system events.

dispatch_source_t

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

dispatch_source_type_t

An identifier for the type of system object being monitored by a dispatch source.

Managing Event Handlers

dispatch_source_set_registration_handler_f

Sets the registration handler function for the given dispatch source.

dispatch_source_set_registration_handler

Sets the registration handler block for the given dispatch source.

dispatch_source_set_event_handler_f

Sets the event handler function for the given dispatch source.

dispatch_source_set_event_handler

Sets the event handler block for the given dispatch source.

dispatch_source_set_cancel_handler_f

Sets the cancellation handler function for the given dispatch source.

dispatch_source_set_cancel_handler

Sets the cancellation handler block for the given dispatch source.

Getting Dispatch Source Attributes

dispatch_source_get_data

Returns pending data for the dispatch source.

dispatch_source_get_mask

Returns the mask of events monitored by the dispatch source.

dispatch_source_get_handle

Returns the underlying system handle associated with the specified dispatch source.

dispatch_source_merge_data

Merges data into a dispatch source and submits its event handler block to its target queue.

dispatch_source_proc_flags_t

Events related to a process.

dispatch_source_vnode_flags_t

Events involving a change to a file system object.

Managing Timer Parameters

dispatch_source_set_timer

Sets a start time, interval, and leeway value for a timer source.

dispatch_source_timer_flags_t

Flags to use when configuring a timer dispatch source.

Canceling a Dispatch Source

dispatch_source_cancel

Asynchronously cancels the dispatch source, preventing any further invocation of its event handler block.

dispatch_source_testcancel

Tests whether the given dispatch source has been canceled.

See Also

System Event Monitoring

Dispatch I/O

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

Dispatch Data

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