class ChannelReadBase

Defined at line 28 of file ../../sdk/lib/driver/runtime/include/lib/fdf/cpp/channel_read.h

Holds context for an asynchronous read and its handler.

After successfully beginning the read, the client is responsible for retaining

the structure in memory (and unmodified) until the read's handler runs,

or the dispatcher shuts down. Thereafter, the read may be begun again or destroyed.

# Thread safety

This class is thread-unsafe.

Concrete implementations: |fdf::ChannelRead|.

Public Methods

zx_status_t Begin (fdf_dispatcher_t * dispatcher)

Begins asynchronously waiting for |channel| 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.

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|.

# Errors

ZX_ERR_INVALID_ARGS: |dispatcher| is an invalid pointer or NULL,

|read_options| is any value other than 0, or |wait_options| is an unknown

value.

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.

Defined at line 17 of file ../../sdk/lib/driver/runtime/channel_read.cc

zx_status_t Cancel ()

Cancels the wait.

Whether the wait handler will run depends on whether the dispatcher it was registered with is

synchronized or |FDF_CHANNEL_WAIT_OPTION_FORCE_ASYNC_CANCEL| was passed with in

to the constructor's |wait_options| argument.

If the dispatcher is synchronized and |FDF_CHANNEL_WAIT_OPTION_FORCE_ASYNC_CANCEL| was not

passed, this must only be called from a dispatcher thread, and any pending callback will be

canceled synchronously.

If the dispatcher is unsynchronized or |FDF_CHANNEL_WAIT_OPTION_FORCE_ASYNC_CANCEL| was passed,

the callback will be scheduled to be called with status |ZX_ERR_CANCELED|.

# Errors

ZX_ERR_NOT_FOUND: There was no pending wait either because it is currently running

(perhaps in a different thread), already scheduled to be run, already completed,

or had not been started.

Defined at line 36 of file ../../sdk/lib/driver/runtime/channel_read.cc

fdf_handle_t channel ()

Defined at line 42 of file ../../sdk/lib/driver/runtime/include/lib/fdf/cpp/channel_read.h

void set_channel (fdf_handle_t channel)

Defined at line 43 of file ../../sdk/lib/driver/runtime/include/lib/fdf/cpp/channel_read.h

uint32_t options ()

Defined at line 45 of file ../../sdk/lib/driver/runtime/include/lib/fdf/cpp/channel_read.h

void set_options (uint32_t options)

Defined at line 46 of file ../../sdk/lib/driver/runtime/include/lib/fdf/cpp/channel_read.h

uint32_t wait_options ()

Defined at line 48 of file ../../sdk/lib/driver/runtime/include/lib/fdf/cpp/channel_read.h

void set_wait_options (uint32_t wait_options)

Defined at line 49 of file ../../sdk/lib/driver/runtime/include/lib/fdf/cpp/channel_read.h

bool is_pending ()

Returns true if the wait has begun and not yet completed or been canceled.

Defined at line 52 of file ../../sdk/lib/driver/runtime/include/lib/fdf/cpp/channel_read.h

Protected Methods

void ChannelReadBase (fdf_handle_t channel, uint32_t read_options, uint32_t wait_options, fdf_channel_read_handler_t * handler)

Defined at line 10 of file ../../sdk/lib/driver/runtime/channel_read.cc

void ~ChannelReadBase ()

Defined at line 15 of file ../../sdk/lib/driver/runtime/channel_read.cc

void ChannelReadBase (const ChannelReadBase & )

ChannelReadBase cannot be moved or copied.

Defined at line 36 of file ../../sdk/lib/driver/runtime/include/lib/fdf/cpp/channel_read.h

void ChannelReadBase (ChannelReadBase && )

Defined at line 37 of file ../../sdk/lib/driver/runtime/include/lib/fdf/cpp/channel_read.h

ChannelReadBase & operator= (const ChannelReadBase & )

Defined at line 38 of file ../../sdk/lib/driver/runtime/include/lib/fdf/cpp/channel_read.h

ChannelReadBase & operator= (ChannelReadBase && )

Defined at line 39 of file ../../sdk/lib/driver/runtime/include/lib/fdf/cpp/channel_read.h

template <typename T>
T * Dispatch (fdf_channel_read_t * channel_read)

Defined at line 103 of file ../../sdk/lib/driver/runtime/include/lib/fdf/cpp/channel_read.h