class WaitBase

Defined at line 30 of file ../../sdk/lib/async/include/lib/async/cpp/wait.h

Holds context for an asynchronous wait and its handler, with RAII semantics.

Automatically cancels the wait when it goes out of scope.

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

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

is successfully canceled, or the dispatcher shuts down. Thereafter, the wait

may be begun again or destroyed.

This class must only be used with single-threaded asynchronous dispatchers

and must only be accessed on the dispatch thread since it lacks internal

synchronization of its state.

Concrete implementations: |async::Wait|, |async::WaitMethod|.

Please do not create subclasses of WaitBase outside of this library.

Public Methods

zx_status_t Begin (async_dispatcher_t * dispatcher)

Begins asynchronously waiting for the object to receive one or more of

the trigger signals. Invokes the handler when the wait completes.

The wait's handler will be invoked exactly once unless the wait is canceled.

When the dispatcher is shutting down (being destroyed), the handlers of

all remaining waits will be invoked with a status of |ZX_ERR_CANCELED|.

Returns |ZX_OK| if the wait was successfully begun.

Returns |ZX_ERR_ACCESS_DENIED| if the object does not have |ZX_RIGHT_WAIT|.

Returns |ZX_ERR_BAD_STATE| if the dispatcher is shutting down.

Returns |ZX_ERR_NOT_SUPPORTED| if not supported by the dispatcher.

Defined at line 40 of file ../../sdk/lib/async/wait.cc

zx_handle_t object ()

Gets or sets the object to wait for signals on.

Defined at line 43 of file ../../sdk/lib/async/include/lib/async/cpp/wait.h

void set_object (zx_handle_t object)

Defined at line 44 of file ../../sdk/lib/async/include/lib/async/cpp/wait.h

zx_signals_t trigger ()

Gets or sets the signals to wait for.

Defined at line 47 of file ../../sdk/lib/async/include/lib/async/cpp/wait.h

void set_trigger (zx_signals_t trigger)

Defined at line 48 of file ../../sdk/lib/async/include/lib/async/cpp/wait.h

uint32_t options ()

Gets or sets the options to wait with. See zx_object_wait_async().

Defined at line 51 of file ../../sdk/lib/async/include/lib/async/cpp/wait.h

void set_options (uint32_t options)

Defined at line 52 of file ../../sdk/lib/async/include/lib/async/cpp/wait.h

zx_status_t Cancel ()

Cancels the wait.

If successful, the wait's handler will not run.

Returns |ZX_OK| if the wait was pending and it has been successfully

canceled; its handler will not run again and can be released immediately.

Returns |ZX_ERR_NOT_FOUND| if there was no pending wait either because it

already completed, or had not been started.

Returns |ZX_ERR_NOT_SUPPORTED| if not supported by the dispatcher.

Defined at line 52 of file ../../sdk/lib/async/wait.cc

bool is_pending ()

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

Defined at line 55 of file ../../sdk/lib/async/include/lib/async/cpp/wait.h

Protected Methods

void WaitBase (zx_handle_t object, zx_signals_t trigger, uint32_t options, async_wait_handler_t * handler)

Defined at line 12 of file ../../sdk/lib/async/wait.cc

void ~WaitBase ()

Defined at line 16 of file ../../sdk/lib/async/wait.cc

void WaitBase (const WaitBase & )

Defined at line 36 of file ../../sdk/lib/async/include/lib/async/cpp/wait.h

void WaitBase (WaitBase && )

Defined at line 37 of file ../../sdk/lib/async/include/lib/async/cpp/wait.h

WaitBase & operator= (const WaitBase & )

Defined at line 38 of file ../../sdk/lib/async/include/lib/async/cpp/wait.h

WaitBase & operator= (WaitBase && )

Defined at line 39 of file ../../sdk/lib/async/include/lib/async/cpp/wait.h

template <typename T>
T * Dispatch (async_wait * wait)

Defined at line 83 of file ../../sdk/lib/async/include/lib/async/cpp/wait.h