1.. _module-pw_work_queue: 2 3============= 4pw_work_queue 5============= 6.. pigweed-module:: 7 :name: pw_work_queue 8 9The ``pw_work_queue`` module contains utilities for deferring work to be 10executed by another thread. 11 12------- 13Example 14------- 15 16.. code-block:: cpp 17 18 #include "pw_thread/detached_thread.h" 19 #include "pw_work_queue/work_queue.h" 20 21 pw::work_queue::WorkQueueWithBuffer<10> work_queue; 22 23 pw::thread::Options& WorkQueueThreadOptions(); 24 void SomeLongRunningProcessing(); 25 26 void SomeInterruptHandler() { 27 // Instead of executing the long running processing task in the interrupt, 28 // the work_queue executes it on the interrupt's behalf. 29 work_queue.CheckPushWork(SomeLongRunningProcessing); 30 } 31 32 int main() { 33 // Start up the work_queue as a detached thread which runs forever. 34 pw::thread::DetachedThread(WorkQueueThreadOptions(), work_queue); 35 } 36 37------------- 38API reference 39------------- 40.. doxygennamespace:: pw::work_queue 41 :members: 42