<!--
{
  "availability" : [
    "iOS: 5.0.0 -",
    "iPadOS: 5.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.7.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Dispatch",
  "identifier" : "/documentation/Dispatch/dispatch_io_close",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Dispatch"
    ],
    "preciseIdentifier" : "c:@F@dispatch_io_close"
  },
  "title" : "dispatch_io_close"
}
-->

# dispatch_io_close

Closes the specified channel to new read and write operations.

```
extern void dispatch_io_close(dispatch_io_t channel, dispatch_io_close_flags_t flags);
```

## Parameters

`channel`

The channel to close.

`flags`

The options to use when closing the channel. For a list of possible values, see [`dispatch_io_close_flags_t`](/documentation/Dispatch/dispatch_io_close_flags_t).

## Discussion

After calling this function, you should not schedule any more read or write operations on the channel. Doing so causes an error to be sent to your handler.

If the [`DISPATCH_IO_STOP`](/documentation/Dispatch/DISPATCH_IO_STOP) option is specified in the `flags` parameter, the system attempts to interrupt any outstanding read and write operations on the I/O channel. Even if you specify this flag, the corresponding handlers may be invoked with partial results. In addition, the final invocation of the handler is passed the `ECANCELED` error code to indicate that the operation was interrupted. If you do not specify the [`DISPATCH_IO_STOP`](/documentation/Dispatch/DISPATCH_IO_STOP) flag, read and write operations on the channel run to completion as normal.

---

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)