<!--
{
  "documentType" : "article",
  "framework" : "Dispatch",
  "identifier" : "/documentation/Dispatch/dispatch-i-o",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "Dispatch I/O"
}
-->

# Dispatch I/O

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

## Topics

### Creating a Dispatch I/O Object

[`dispatch_io_create`](/documentation/Dispatch/dispatch_io_create)

Creates a dispatch I/O channel and associates it with the specified file descriptor.

[`dispatch_io_create_with_io`](/documentation/Dispatch/dispatch_io_create_with_io)

Creates a new dispatch I/O channel from an existing channel.

[`dispatch_io_create_with_path`](/documentation/Dispatch/dispatch_io_create_with_path)

Creates a dispatch I/O channel with the associated path name.

[`dispatch_io_t`](/documentation/Dispatch/dispatch_io_t)

A dispatch I/O channel.

[`dispatch_fd_t`](/documentation/Dispatch/dispatch_fd_t)

A file descriptor used for I/O operations.

[`OS_dispatch_io`](/documentation/Dispatch/OS_dispatch_io)

[`dispatch_io_type_t`](/documentation/Dispatch/dispatch_io_type_t)

The type of a dispatch I/O channel.

### Reading from the File

[`dispatch_read`](/documentation/Dispatch/dispatch_read)

Schedules an asynchronous read operation using the specified file descriptor.

[`dispatch_io_read`](/documentation/Dispatch/dispatch_io_read)

Schedules an asynchronous read operation on the specified channel.

[`dispatch_io_handler_t`](/documentation/Dispatch/dispatch_io_handler_t)

A handler block used to process operations on a dispatch I/O channel.

### Writing to the File

[`dispatch_write`](/documentation/Dispatch/dispatch_write)

Schedules an asynchronous write operation using the specified file descriptor.

[`dispatch_io_write`](/documentation/Dispatch/dispatch_io_write)

Schedules an asynchronous write operation for the specified channel.

### Closing the File

[`dispatch_io_close`](/documentation/Dispatch/dispatch_io_close)

Closes the specified channel to new read and write operations.

[`dispatch_io_close_flags_t`](/documentation/Dispatch/dispatch_io_close_flags_t)

Additional flags to use when closing an I/O channel.

### Managing the File Descriptor

[`dispatch_io_get_descriptor`](/documentation/Dispatch/DispatchIO/fileDescriptor)

Returns the file descriptor associated with the specified channel.

[`dispatch_io_set_interval`](/documentation/Dispatch/dispatch_io_set_interval)

Sets the interval (in nanoseconds) at which to invoke the I/O handlers for the channel.

[`dispatch_io_interval_flags_t`](/documentation/Dispatch/dispatch_io_interval_flags_t)

The desired delivery behavior for interval events.

[`dispatch_io_set_low_water`](/documentation/Dispatch/DispatchIO/setLimit(lowWater:))

Sets the minimum number of bytes to process before enqueueing a handler block.

[`dispatch_io_set_high_water`](/documentation/Dispatch/DispatchIO/setLimit(highWater:))

Sets the maximum number of bytes to process before enqueueing a handler block.

### Synchronizing File Operations

[`dispatch_io_barrier`](/documentation/Dispatch/DispatchIO/barrier(execute:))

Schedules a barrier operation on the specified channel.



---

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)