C/C++ API Reference
Loading...
Searching...
No Matches
pw::work_queue::CustomWorkQueue< WorkItem > Class Template Reference

Overview

template<typename WorkItem>
class pw::work_queue::CustomWorkQueue< WorkItem >

Enables threads and interrupts to enqueue work as a pw::work_queue::WorkItem for execution by the work queue.

Queue sizing: The number of outstanding work requests is limited based on the internal queue size. The queue size is set through either the size of the queue_storage buffer passed into the constructor or by using the templated pw::work_queue::WorkQueueWithBuffer helper. When the queue is full, the queue will not accept further work.

Cooperative thread cancellation: The class is a pw::thread::ThreadCore, meaning it should be executed as a single thread. To facilitate clean shutdown, it provides a RequestStop() method for cooperative cancellation which should be invoked before joining the thread. Once a stop has been requested the queue will no longer accept further work.

The entire API is thread-safe and interrupt-safe.

Inheritance diagram for pw::work_queue::CustomWorkQueue< WorkItem >:
pw::work_queue::CustomWorkQueueWithBuffer< kWorkQueueEntries, WorkItem >

Public Member Functions

 CustomWorkQueue (InlineQueue< WorkItem > &queue, pw::Function< void(WorkItem &)> &&fn)
 
Status PushWork (WorkItem &&work_item)
 
void CheckPushWork (WorkItem &&work_item)
 
void CheckPushWork (WorkItem &work_item)
 
void RequestStop ()
 

The documentation for this class was generated from the following file: