class TaskQueue

Defined at line 51 of file ../../sdk/lib/async_patterns/cpp/internal/task_queue.h

A task queue that offers thread-safe task insertion and inversion of control:

tasks added to the queue are not immediately/synchronously run. Rather, they

are run (or canceled) when the synchronize dispatcher comes around to

process them.

If the dispatcher is shut down, all tasks will be silently destroyed.

Public Methods

std::shared_ptr<TaskQueue> Create (async_dispatcher_t * dispatcher, const char * description)

Constructs an empty task queue. |dispatcher| will be used to run

tasks added to the queue.

Thread safety: |TaskQueue| must be constructed on the associated

synchronized dispatcher.

Defined at line 15 of file ../../sdk/lib/async_patterns/cpp/internal/task_queue.cc

void ~TaskQueue ()

Destroys the queue.

Invariant: |Stop| must be called before destruction.

Thread safety: |TaskQueue| may be destroyed on any thread.

Defined at line 32 of file ../../sdk/lib/async_patterns/cpp/internal/task_queue.cc

void Add (std::unique_ptr<Task> task)

Schedules a task onto the queue. Wakes the dispatcher if not already.

Thread safety: |Add| can be called from any threads.

Defined at line 39 of file ../../sdk/lib/async_patterns/cpp/internal/task_queue.cc

void Stop ()

Atomically puts the queue into a state where no future tasks will be run.

Tasks that are pending will be destroyed during |Stop|. Tasks added after

|Stop| will be immediately destroyed in their respective |Add| calls.

Cancels the pending wake in the dispatcher if any.

Thread safety: |Stop| must be called from the synchronized dispatcher that

is running the tasks.

Defined at line 59 of file ../../sdk/lib/async_patterns/cpp/internal/task_queue.cc

void TaskQueue (async_dispatcher_t * dispatcher, const char * description)

Defined at line 20 of file ../../sdk/lib/async_patterns/cpp/internal/task_queue.cc

void TaskQueue (const TaskQueue & )

Defined at line 82 of file ../../sdk/lib/async_patterns/cpp/internal/task_queue.h

TaskQueue & operator= (const TaskQueue & )

Defined at line 83 of file ../../sdk/lib/async_patterns/cpp/internal/task_queue.h

void TaskQueue (TaskQueue && )

Defined at line 84 of file ../../sdk/lib/async_patterns/cpp/internal/task_queue.h

TaskQueue & operator= (TaskQueue && )

Defined at line 85 of file ../../sdk/lib/async_patterns/cpp/internal/task_queue.h