Function

dispatch_io_set_interval

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

Declaration

void dispatch_io_set_interval(dispatch_io_t channel, uint64_t interval, dispatch_io_interval_flags_t flags);

Parameters

channel

The channel whose interval you want to configure.

interval

The number of nanoseconds that must elapse before the scheduling of any I/O handlers is desired.

flags

Flags indicating the desired delivery behavior at the interval time. For a list of flags, see dispatch_io_interval_flags_t.

Discussion

A channel interval is a way for you to receive periodic progress reports on the state of a read or write operation. You can use this feedback to update progress bars or other parts of your application.

If you set an interval on a channel, the handlers for any read or write operations are enqueued at the given interval only if the amount of data that has been processed exceeds the current low-water mark for the channel. Passing the DISPATCH_IO_STRICT_INTERVAL constant in the flags parameter forces the enqueueing of the handlers even if the low-water mark is not exceeded.

The system may add a small amount of leeway to the specified interval in order to align the delivery of handlers with other system activity. The purpose of this behavior is to improve overall performance or power consumption for the system.

See Also

Managing the File Descriptor

dispatch_io_get_descriptor

Returns the file descriptor associated with the specified channel.

dispatch_io_interval_flags_t

The type for flags used to specify the dispatch interval of a channel.

dispatch_io_set_low_water

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

dispatch_io_set_high_water

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

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