class ClosureQueue

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

Public Methods

void ClosureQueue (async_dispatcher_t * dispatcher)

This must happen on a thread managed by dispatcher. Do not call SetDispatcher() after this

constructor.

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

void ClosureQueue ()

Must call SetDispatcher() before using the queue.

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

void SetDispatcher (async_dispatcher_t * dispatcher)

This call must happen on a thread managed by dispatcher.

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

void ~ClosureQueue ()

This must be called only on the dispatcher.

Defined at line 24 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 on the dispatcher.

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 33 of file ../../zircon/system/ulib/closure-queue/closure_queue.cc

void StopAndClear ()

This can only be called on the dispatcher. This prevents any additional

calls to Enqueue() from actually enqueuing 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 the dispatcher.

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

bool is_stopped ()

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

bool IsSynchronized ()

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