Skip to main content

fdf_channel_wait_async

Function fdf_channel_wait_async 

Source
pub unsafe extern "C" fn fdf_channel_wait_async(
    dispatcher: *mut fdf_dispatcher,
    channel_read: *mut fdf_channel_read,
    options: u32,
) -> zx_status_t
Expand description

Begins asynchronously waiting for the channel set in |channel_read| to be readable. The |dispatcher| invokes the handler when the wait completes. Only one dispatcher can be registered at a time. The dispatcher will be considered unregistered immediately before the read handler is invoked.

After successfully scheduling the read, the client is responsible for retaining the |channel_read| structure in memory (and unmodified) until the read handler runs, or the dispatcher shuts down. Thereafter, the |channel_read| may be started again or destroyed.

The read handler will be invoked exactly once. When the dispatcher is shutting down (being destroyed), the handlers of any remaining wait may be invoked with a status of |ZX_ERR_CANCELED|.

If |FDF_CHANNEL_WAIT_OPTION_FORCE_ASYNC_CANCEL| is passed in |options|, a call to |fdf_channel_cancel_wait| will always call the callback rather than cancelling synchronously, even if the wait was started on a synchronized dispatcher.

ยงErrors

ZX_ERR_INVALID_ARGS: |dispatcher| or |channel_read| is an invalid pointer or NULL or |options| is an unknown option.

ZX_ERR_PEER_CLOSED: There are no available messages and the other side of the channel is closed.

ZX_ERR_BAD_STATE: There is already a dispatcher waiting on this channel.

ZX_ERR_UNAVAILABLE: |dispatcher| is shutting down.

This operation is thread-safe.