class ClosureQueue

Defined at line 17 of file ../../zircon/system/ulib/closure-queue/include/lib/closure-queue/closure_queue.h

Public Methods

void ClosureQueue (async_dispatcher_t * dispatcher, thrd_t dispatcher_thread)

This can be called on any thread. Do not call SetDispatcher() after this

constructor.

Defined at line 11 of file ../../zircon/system/ulib/closure-queue/closure_queue.cc

void ClosureQueue ()

Must call SetDispatcher() before using the queue.

Defined at line 15 of file ../../zircon/system/ulib/closure-queue/closure_queue.cc

void SetDispatcher (async_dispatcher_t * dispatcher, thrd_t dispatcher_thread)

Defined at line 19 of file ../../zircon/system/ulib/closure-queue/closure_queue.cc

void ~ClosureQueue ()

This must be called only on dispatcher_thread.

Defined at line 25 of file ../../zircon/system/ulib/closure-queue/closure_queue.cc

void Enqueue (fit::closure to_run)

If StopAndClear() isn't called yet, runs to_run on dispatcher.

If StopAndClear() has already been called, deletes to_run on this thread.

If StopAndClear() is called after Enqueue() returns but before to_run has

been run on dispatcher, deletes to_run on thread that calls StopAndClear().

If run, to_run will run using the dispatcher, on the dispatcher_thread.

This can be called on any thread.

TODO(dustingreen): Consider adding an over-full threshold that permits

client code to notice when the queue is more full than expected (more full

than makes any sense for a given protocol).

Defined at line 34 of file ../../zircon/system/ulib/closure-queue/closure_queue.cc

void StopAndClear ()

This can only be called on the dispatcher_thread. This prevents any

additional calls to Enqueue() from actually enqueing anything, and deletes

any previously-queued tasks that haven't already run.

This is idempotent, and will run automatically at the start of

~ClosureQueue, but client code is encouraged to call StopAndClear() earlier

than ~ClosureQueue if that helps ensure that all the captures of all the

queued lambdas will still be fully usable up to the point where

StopAndClear() is called.

This must be called only on dispatcher_thread.

Defined at line 39 of file ../../zircon/system/ulib/closure-queue/closure_queue.cc

bool is_stopped ()

Defined at line 44 of file ../../zircon/system/ulib/closure-queue/closure_queue.cc

thrd_t dispatcher_thread ()

Defined at line 52 of file ../../zircon/system/ulib/closure-queue/closure_queue.cc